You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/PDF/Smart-PDF-Viewer/blazor/custom-ai-service.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ documentation: ug
11
11
12
12
## Overview
13
13
14
-
Syncfusion Smart PDF Viewer provide built-in support for OpenAI and Azure OpenAI services. However, you can also integrate other AI services using the `IChatInferenceService` interface, which acts as a bridge between Smart PDF Viewer and your custom AI service.
14
+
Syncfusion Smart PDF Viewer provides built-in support for OpenAI and Azure OpenAI services. It can also connect to other AI providers through the `IChatInferenceService` interface, which acts as a bridge between the viewer and a custom AI service.
15
15
16
16
17
17
## IChatInferenceService Interface
@@ -26,13 +26,13 @@ public interface IChatInferenceService
26
26
```
27
27
28
28
This interface enables:
29
-
- Consistent communication between components and AI services
30
-
- Easy switching between different AI providers
29
+
- Consistent communication between components and AI services.
30
+
- Easy switching between different AI providers.
31
31
32
32
33
33
## Implemented AI Services
34
34
35
-
Here are examples of AI services integrated using the `IChatInferenceService` interface:
35
+
The following examples demonstrate AI services integrated using the `IChatInferenceService` interface:
36
36
37
37
| Service | Documentation |
38
38
|---------|---------------|
@@ -43,7 +43,7 @@ Here are examples of AI services integrated using the `IChatInferenceService` in
43
43
44
44
## Service Registration
45
45
46
-
Register your custom implementation in `Program.cs`:
46
+
Register the custom implementation in `Program.cs`:
Since the Custom AI service operates independently from the built-in AI service, error popups must be handled at the sample level. To capture error details, use a try-catch block within the request and response logic of the Custom AI service. Once an error message is received, pass it to the Smart PDF Viewer component, where it should be displayed in a dialog—replicating the behavior of the default built-in error popup.
55
+
Because a custom AI service operates independently of the built-in providers, error popups must be handled at the sample level. Capture errors with try-catch in the request/response flow, propagate the message to the Smart PDF Viewer component, and display it in a dialog to mirror the built-in behavior. For production scenarios, surface user-friendly messages while logging technical details.
56
56
57
57
### Capture Error in CustomService
58
58
59
-
Exceptions that occur while creating a request to the custom AI service are captured using try-catch blocks. The resulting error message is assigned to the DialogMessage property, and the OnDialogOpen event is triggered to notify other components such as Home so they can display the error in a dialog appropriately.
59
+
Use try-catch to capture exceptions during request creation or response handling. Assign the message to the `DialogMessage` property and raise `OnDialogOpen`to notify listening components to render the dialog. Consider mapping low-level exceptions to localized, user-friendly text.
60
60
61
61
## Step 1: Create a ErrorDialog Service
62
62
63
-
1.Create a new class file named ErrorDialogService.cs in your project
64
-
2.Add the following implementation:
63
+
1.Create a new class file named ErrorDialogService.cs in the project.
64
+
2.Add the following implementation:
65
65
66
66
```cs
67
67
publicclassErrorDialogService
@@ -110,7 +110,7 @@ public class ErrorDialogService
110
110
111
111
### Step 3: Configure the Dialog Service
112
112
113
-
Configure the dialog service in `Program.cs` to enable error display functionality when a request or response to the Custom AI service fails. This setup ensures that any errors encountered during communication with the service can be shown in a dialog component.
113
+
Configure services in `Program.cs` to enable error display when a request or response to the custom AI service fails. This setup ensures any errors encountered during communication can be surfaced via a dialog component.
In the Smart PDF Viewer, error messages are displayed using SfDialogService. The component listens for the OnDialogOpen event from CustomService, and when triggered, the OpenDialog method calculates the dialog size dynamically based on the length of the error message and presents it accordingly. To ensure efficient resource management, the event subscription is properly disposed of when the component is no longer in use.
144
+
In Smart PDF Viewer, error messages are displayed using `SfDialogService`. The component subscribes to `OnDialogOpen`from the custom service and, when triggered, `OpenDialog` computes a dialog size based on message length and shows it. The subscription is disposed when the component is no longer in use.
145
145
146
-
1.Create a new class file named Home.razor.cs by right-clicking on the Pages folder, then selecting Add → Class.
147
-
2.Add the following implementation:
146
+
1.Create a new class file named Home.razor.cs by right-clicking the Pages folder, then selecting Add → Class.
Copy file name to clipboardExpand all lines: Document-Processing/PDF/Smart-PDF-Viewer/blazor/deepseek-service.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,15 @@ documentation: ug
9
9
10
10
# Getting Started with Smart PDF Viewer using DeepSeek AI
11
11
12
-
This guide demonstrates how to integrate DeepSeek's powerful AI capabilities with Syncfusion Smart PDF Viewer in your Blazor App.
12
+
This guide explains how to integrate DeepSeekAI with the Syncfusion Smart PDF Viewer in a Blazor app.
13
13
14
14
## Prerequisites
15
15
16
16
Before you begin, ensure you have:
17
17
18
18
*[System requirements for Blazor components](https://blazor.syncfusion.com/documentation/system-requirements)
19
19
* DeepSeek account and API key (see setup instructions below)
20
+
* A supported .NET SDK and target framework for the installed Syncfusion Blazor version
20
21
21
22
### Setting Up DeepSeek
22
23
@@ -41,21 +42,23 @@ After completing this setup, you can:
41
42
42
43
## Install the following NuGet packages to your project:
43
44
44
-
open the NuGet package manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), search and install the following packages
45
+
Open the NuGet Package Manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), then search and install the following packages:
To integrate DeepSeek with Syncfusion Smart PDF Viewer, we'll create a custom implementation of the `IChatInferenceService` interface. This interface acts as a bridge between Syncfusion Smart PDF Viewer and your AI service.
53
54
54
-
The `IChatInferenceService` interface is the bridge between Syncfusion Smart PDF Viewer and AI services:S
55
+
The `IChatInferenceService` interface is the bridge between Syncfusion Smart PDF Viewer and AI services:
55
56
56
57
1. Create a new file named `MyCustomService.cs`
57
58
2. Add the following implementation:
58
59
60
+
N> Ensure the project includes required using directives and valid XML documentation tags in custom code implementations.
N> Running the DeepSeek service may lead to slower response times due to system resource usage. To accommodate this, configure the Syncfusion Smart PDF Viewer to disable timeout for AI assist view operations by setting the timeout to 0. [Learn more](https://help.syncfusion.com/document-processing/pdf/smart-pdf-viewer/blazor/document-summarizer#timeout)
Copy file name to clipboardExpand all lines: Document-Processing/PDF/Smart-PDF-Viewer/blazor/getting-started/maui-blazor-app.md
+42-38Lines changed: 42 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,27 @@
1
1
---
2
2
layout: post
3
-
title: Deploy SfSmartPdfViewer in Blazor MAUI in windows | Syncfusion
4
-
description: Learn how to deploy SfSmartPdfViewer in Blazor MAUI Application on Windows in Syncfusion Blazor SfSmartPdfViewer component and much more details.
3
+
title: Use Smart PDF Viewer in Blazor MAUI in Windows | Syncfusion
4
+
description: Learn how to add and run the Syncfusion Blazor Smart PDF Viewer in a .NET MAUI Blazor app on Windows and Android, including package installation.
5
5
platform: document-processing
6
6
control: SfSmartPdfViewer
7
7
documentation: ug
8
8
---
9
9
10
10
# Using Smart PDF Viewer Component in the Blazor MAUI app
11
11
12
-
In this section, we'll guide you through the process of adding Syncfusion® Blazor Smart PDF Viewer component to your Blazor Maui app. We'll break it down into simple steps to make it easy to follow.
12
+
This section describes how to add the Syncfusion® Blazor Smart PDF Viewer component to a .NET MAUI Blazor app and run it on Windows and Android.
13
13
14
14
## Prerequisites
15
15
16
-
To use the MAUI project templates, install the Mobile development with the .NET extension for Visual Studio. For more details, refer to [here](https://learn.microsoft.com/en-us/dotnet/MAUI/get-started/installation?tabs=vswin).
16
+
To use MAUI project templates, install the Mobile development with .NET workload for Visual Studio. For detailed steps, see [Install .NET MAUI](https://learn.microsoft.com/en-us/dotnet/MAUI/get-started/installation?tabs=vswin) on Windows in the Microsoft documentation.
17
17
18
18
## Create a new Blazor MAUI App in Visual Studio
19
19
20
-
Create a new Blazor MAUI app and by selecting the template **.NET MAUI Blazor Hybrid APP** in VS.
20
+
Create a new .NET MAUI Blazor App in Visual Studio by selecting the template named **.NET MAUI Blazor Hybrid APP**.
21
21
22
22
## Install Smart PDF Viewer NuGet package in Blazor Maui App
23
23
24
-
Add the following NuGet packages into the Blazor Maui app.
24
+
Add the following NuGet packages to the Blazor MAUI app.
Note: Ensure the Syncfusion license is registered in the application before using Syncfusion components.
84
+
83
85
## To Configure Azure OpenAI Service
84
86
87
+
This section is required only when enabling AI-powered features in Smart PDF Viewer (such as document summarization, smart redaction, or smart fill). It is not required for basic PDF rendering.
88
+
85
89
In **Visual Studio**, Go to Tools → NuGet Package Manager → Package Manager Console. Run these commands one by one:
For **Azure OpenAI**, first [deploy an Azure OpenAI Service resource and model](https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/create-resource?pivots=web-portal), then values for `apiKey`, `deploymentName` and `endpoint` will all be provided to you.
147
+
For **Azure OpenAI**, first [deploy an Azure OpenAI Service resource and model](https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/create-resource?pivots=web-portal), then the values for `apiKey`, `deploymentName`, and `endpoint` will be available.
144
148
145
149
## Adding stylesheet and script
146
150
@@ -161,7 +165,7 @@ Add the following stylesheet and script to the head section of the **~/wwwroot/i
161
165
162
166
## Add Smart PDF Viewer component
163
167
164
-
Add the Syncfusion<supstyle="font-size:70%">®</sup> PDF Viewer (Next Gen) component in the **~/Pages/Index.razor** file.
168
+
Add the Syncfusion Blazor Smart PDF Viewer component in the **~/Pages/Index.razor** file.
165
169
166
170
{% tabs %}
167
171
{% highlight razor %}
@@ -176,30 +180,30 @@ Add the Syncfusion<sup style="font-size:70%">®</sup> PDF Viewer (Next Gen) c
176
180
177
181
## Run on Windows
178
182
179
-
Run the sample in Windows Machine mode, and it will run Blazor MAUI in Windows.
183
+
Run the sample in Windows Machine mode. The application will run the Blazor MAUI app targeting Windows.
180
184
181
-

185
+

182
186
183
-
Upon successfully launching the application, the PDF Viewer component will seamlessly render the specified PDF document within its interface.
187
+
After the application launches, the PDF Viewer component renders the specified PDF document within its interface.

186
190
187
191
## Run on Android
188
192
189
-
To run the PDF Viewer in a Blazor Android MAUI application using the Android emulator, follow these steps:
193
+
To run the PDF Viewer in a Blazor Android MAUI application using the Android emulator, follow these steps. These steps are required only when using local embeddings for AI features; they are not needed for basic PDF viewing.
190
194
191
-
1. Add the following Assets files in your Project by creating Assets folder(Platform -> Android -> Assets)
@@ -230,18 +234,18 @@ public static class MauiProgram
230
234
await assetStream.CopyToAsync(fileStream);
231
235
}
232
236
}
233
-
}
237
+
}
234
238
}
235
239
{% endhighlight %}
236
240
{% endtabs %}
237
241
238
-

242
+

239
243
240
-
Refer [here](https://learn.microsoft.com/en-us/dotnet/maui/android/emulator/device-manager#android-device-manager-on-windows) to install and launch Android emulator.
244
+
Refer [here](https://learn.microsoft.com/en-us/dotnet/maui/android/emulator/device-manager#android-device-manager-on-windows) to Set up the Android emulator with Android Device Manager.
241
245
242
-
N> If you encounter any errors while using the Android Emulator, refer to the following link for troubleshooting guidance[Troubleshooting Android Emulator](https://learn.microsoft.com/en-us/dotnet/maui/android/emulator/troubleshooting).
246
+
N> If any errors occur while using the Android Emulator, see [Troubleshooting the Android Emulator](https://learn.microsoft.com/en-us/dotnet/maui/android/emulator/troubleshooting).
0 commit comments