Skip to content

Commit a6a2a3a

Browse files
984779: Update the review changes
1 parent e5b68a6 commit a6a2a3a

File tree

5 files changed

+62
-72
lines changed

5 files changed

+62
-72
lines changed

Document-Processing-toc.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,9 +1649,9 @@
16491649
</ul>
16501650
<li>Blazor Hybrid
16511651
<ul>
1652-
<li><a href="/document-processing/pdf/smart-pdf-viewer/blazor/getting-started/maui-blazor-app">Blazor MAUI App</a></li>
1653-
<li><a href="/document-processing/pdf/smart-pdf-viewer/blazor/getting-started/wpf-app">WPF</a></li>
1654-
<li><a href="/document-processing/pdf/smart-pdf-viewer/blazor/getting-started/winforms-app">Windows Forms</a></li>
1652+
<li><a href="/document-processing/pdf/smart-pdf-viewer/blazor/getting-started/maui-blazor-app">.NET MAUI</a></li>
1653+
<li><a href="/document-processing/pdf/smart-pdf-viewer/blazor/getting-started/wpf-blazor-app">WPF Blazor App</a></li>
1654+
<li><a href="/document-processing/pdf/smart-pdf-viewer/blazor/getting-started/winforms-blazor-app">WinForms Blazor App</a></li>
16551655
</ul>
16561656
</li>
16571657
</li>

Document-Processing/PDF/Smart-PDF-Viewer/blazor/getting-started/winforms-app.md renamed to Document-Processing/PDF/Smart-PDF-Viewer/blazor/getting-started/winforms-blazor-app.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ To add **Blazor Smart PDF Viewer** component in the app, open the NuGet package
3131
* [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes)
3232
* [Microsoft.AspNetCore.Components.WebView.WindowsForms](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.WebView.WindowsForms)
3333

34+
N> Ensure that the package `Microsoft.AspNetCore.Components.WebView.WindowsForms` updated to version `8.0.16`.
35+
36+
![WinForms Blazor App Smart Pdfviewer NuGet package reference](../images/winforms-smart-pdfviewe-package.png)
37+
3438
{% endtabcontent %}
3539

3640
{% tabcontent Visual Studio Code %}
@@ -75,6 +79,8 @@ dotnet restore
7579

7680
N> Syncfusion&reg; Blazor components are available on [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). See [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) for the list of available packages and component details.
7781

82+
N> Ensure that the package `Microsoft.AspNetCore.Components.WebView.WindowsForms` updated to version `8.0.16`.
83+
7884
{% endtabcontent %}
7985

8086
{% endtabcontents %}
@@ -83,21 +89,17 @@ N> Syncfusion&reg; Blazor components are available on [nuget.org](https://www.nu
8389

8490
The WinForms project must target Windows and enable WinForms. A typical project file looks like the following.
8591

86-
```csproj
92+
{% tabs %}
93+
{% highlight xml tabtitle="WinFormsBlazorHybridApp.csproj" hl_lines="1" %}
8794

8895
<Project Sdk="Microsoft.NET.Sdk.Razor">
8996

90-
<PropertyGroup>
91-
<OutputType>WinExe</OutputType>
92-
<TargetFramework>net9.0-windows</TargetFramework>
93-
<Nullable>enable</Nullable>
94-
<UseWindowsForms>true</UseWindowsForms>
95-
<ImplicitUsings>enable</ImplicitUsings>
96-
</PropertyGroup>
97+
....
9798

9899
</Project>
99100

100-
```
101+
{% endhighlight %}
102+
{% endtabs %}
101103

102104
Create a `Component` folder, add an `_Imports.razor` file in it, and include the required component namespaces within that folder.
103105

@@ -116,8 +118,8 @@ Create a `Component` folder, add an `_Imports.razor` file in it, and include the
116118

117119
* Inside wwwroot, create an index.html host page for the Blazor UI. This host page is required by BlazorWebView to initialize the Blazor runtime and load static assets (themes and scripts). A basic index.html might look like the following:
118120

119-
120-
```html
121+
{% tabs %}
122+
{% highlight html tabtitle="wwwroot/index.html" hl_lines="8 13" %}
121123

122124
<!DOCTYPE html>
123125
<html>
@@ -135,8 +137,10 @@ Create a `Component` folder, add an `_Imports.razor` file in it, and include the
135137
</body>
136138
</html>
137139

140+
{% endhighlight %}
141+
{% endtabs %}
138142

139-
```
143+
N> Ensure that the smart pdfviewer static assets (themes and scripts) are loaded properly.
140144

141145
## To Configure Azure OpenAI Service
142146

@@ -169,7 +173,7 @@ dotnet add package Microsoft.Extensions.AI.OpenAI --version 9.8.0-preview.1.2541
169173
Register Syncfusion Blazor services and BlazorWebView in **~/Form1.cs** so that the WinForms window can host Blazor components.
170174

171175
{% tabs %}
172-
{% highlight c# tabtitle="Form1.cs (WinForms host)" hl_lines="2 3 4 5 6 7 8 9 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35" %}
176+
{% highlight c# tabtitle="Form1.cs (WinForms host)" hl_lines="2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 31" %}
173177

174178
namespace WinFormsBlazorHybridApp;
175179
using Microsoft.AspNetCore.Components.WebView.WindowsForms;
@@ -180,13 +184,9 @@ using Syncfusion.Blazor;
180184
using Syncfusion.Blazor.AI;
181185
using System.ClientModel;
182186
using WinFormsBlazorHybridApp.Components;
183-
184-
public partial class Form1 : Form
185-
{
186-
public Form1()
187-
{
187+
....
188188
InitializeComponent();
189-
var services = new ServiceCollection();
189+
ServiceCollection services = new ServiceCollection();
190190
services.AddWindowsFormsBlazorWebView();
191191
services.AddMemoryCache();
192192
services.AddSyncfusionBlazor();
@@ -197,7 +197,7 @@ public partial class Form1 : Form
197197
IChatClient azureOpenAiChatClient = azureOpenAIClient.GetChatClient(azureOpenAiModel).AsIChatClient();
198198
services.AddChatClient(azureOpenAiChatClient);
199199
services.AddSingleton<IChatInferenceService, SyncfusionAIService>();
200-
var blazorWebView = new BlazorWebView()
200+
BlazorWebView blazorWebView = new BlazorWebView()
201201
{
202202
HostPage = "wwwroot\\index.html",
203203
Services = services.BuildServiceProvider(),
@@ -206,12 +206,9 @@ public partial class Form1 : Form
206206
blazorWebView.RootComponents.Add<YourRazorFileName>("#app");
207207
// Replace 'YourRazorFileName' with the actual Razor component class (e.g., Main) in your project's namespace
208208
this.Controls.Add(blazorWebView);
209-
}
210-
}
211-
209+
....
212210

213211
{% endhighlight %}
214-
215212
{% endtabs %}
216213

217214
## Adding Blazor Smart PDF Viewer component
@@ -233,12 +230,15 @@ Create a Razor component (for example, SmartPDFViewer.razor) in the project and
233230

234231
Run the WinForms application. The Syncfusion&reg; Blazor Smart PDF Viewer renders inside the WinForms window.
235232

236-
![WPF Blazor HybridApp Smart PDF Viewer rendering in browser](../images/blazor-hybrid-winforms-sfsmartpdfviewer.png)
233+
![WinForms Blazor HybridApp Smart PDF Viewer rendering in browser](../images/blazor-hybrid-winforms-sfsmartpdfviewer.png)
237234

238235
>[View the sample on GitHub](https://github.com/SyncfusionExamples/blazor-smart-pdf-viewer-examples/tree/master/GettingStartedWinForms).
239236
240237
## See also
241238

239+
* [Getting Started with Blazor Smart PDF Viewer Component in Blazor Web App](./web-app)
240+
* [Getting Started with Blazor Smart PDF Viewer Component in WPF Blazor Hybrid App](./wpf-blazor-app)
241+
* [Getting Started with Blazor Smart PDF Viewer Component in MAUI Blazor App](./maui-blazor-app)
242242
* [Document Summarizer in Blazor Smart PDF Viewer](../document-summarizer)
243243
* [Smart Redaction in Blazor Smart PDF Viewer](../smart-redaction)
244244
* [Smart Fill in Blazor Smart PDF Viewer](../smart-fill).

Document-Processing/PDF/Smart-PDF-Viewer/blazor/getting-started/wpf-app.md renamed to Document-Processing/PDF/Smart-PDF-Viewer/blazor/getting-started/wpf-blazor-app.md

Lines changed: 34 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ To add **Blazor Smart PDF Viewer** component in the app, open the NuGet package
3131
* [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes)
3232
* [Microsoft.AspNetCore.Components.WebView.Wpf](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.WebView.Wpf)
3333

34+
N> Ensure that the package `Microsoft.AspNetCore.Components.WebView.Wpf` updated to version `8.0.16`.
35+
36+
![WPF Blazor App Smart PDF Viewer NuGet package reference](../images/wpf-smart-pdfviewer-package.png)
37+
3438
{% endtabcontent %}
3539

3640
{% tabcontent Visual Studio Code %}
@@ -74,6 +78,8 @@ dotnet restore
7478

7579
N> Syncfusion&reg; Blazor components are available on [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). See [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) for the list of available packages and component details.
7680

81+
N> Ensure that the package `Microsoft.AspNetCore.Components.WebView.Wpf` updated to version `8.0.16`.
82+
7783
{% endtabcontent %}
7884

7985
{% endtabcontents %}
@@ -82,21 +88,17 @@ N> Syncfusion&reg; Blazor components are available on [nuget.org](https://www.nu
8288

8389
The WPF project must target Windows and enable WPF. A typical project file looks like the following.
8490

85-
```csproj
91+
{% tabs %}
92+
{% highlight xml tabtitle="WPFBlazorHybridApp.csproj" hl_lines="1" %}
8693

8794
<Project Sdk="Microsoft.NET.Sdk.Razor">
8895

89-
<PropertyGroup>
90-
<OutputType>WinExe</OutputType>
91-
<TargetFramework>net9.0-windows</TargetFramework>
92-
<Nullable>enable</Nullable>
93-
<ImplicitUsings>enable</ImplicitUsings>
94-
<UseWPF>true</UseWPF>
95-
</PropertyGroup>
96+
....
9697

9798
</Project>
9899

99-
```
100+
{% endhighlight %}
101+
{% endtabs %}
100102

101103
Create an `_Imports.razor` and add the component namespace
102104

@@ -140,32 +142,18 @@ dotnet add package Microsoft.Extensions.AI.OpenAI --version 9.8.0-preview.1.2541
140142
Register Syncfusion Blazor services, AI services and BlazorWebView in **~/MainWindow.xaml.cs** so that the WPF window can host Blazor components.
141143

142144
{% tabs %}
143-
{% highlight c# tabtitle="MainWindow.xaml.cs (WPF host)" hl_lines="11 12 13 14 15 16 24 25 26 27 28 29 30 31 32 33 34 35" %}
144-
145-
using System.Text;
146-
using System.Windows;
147-
using System.Windows.Controls;
148-
using System.Windows.Data;
149-
using System.Windows.Documents;
150-
using System.Windows.Input;
151-
using System.Windows.Media;
152-
using System.Windows.Media.Imaging;
153-
using System.Windows.Navigation;
154-
using System.Windows.Shapes;
145+
{% highlight c# tabtitle="MainWindow.xaml.cs (WPF host)" hl_lines="2 3 4 5 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22" %}
146+
147+
....
155148
using Microsoft.Extensions.DependencyInjection;
156149
using Azure.AI.OpenAI;
157150
using Microsoft.Extensions.AI;
158151
using Syncfusion.Blazor;
159152
using Syncfusion.Blazor.AI;
160153
using System.ClientModel;
161-
namespace WPFBlazorHybridApp;
162-
{
163-
public partial class MainWindow : Window
164-
{
165-
public MainWindow()
166-
{
154+
....
167155
InitializeComponent();
168-
var serviceCollection = new ServiceCollection();
156+
ServiceCollection serviceCollection = new ServiceCollection();
169157
serviceCollection.AddWpfBlazorWebView();
170158
serviceCollection.AddMemoryCache();
171159
serviceCollection.AddSyncfusionBlazor();
@@ -177,12 +165,9 @@ namespace WPFBlazorHybridApp;
177165
serviceCollection.AddChatClient(azureOpenAiChatClient);
178166
serviceCollection.AddSingleton<IChatInferenceService, SyncfusionAIService>();
179167
Resources.Add("services", serviceCollection.BuildServiceProvider());
180-
}
181-
}
182-
}
168+
....
183169

184170
{% endhighlight %}
185-
186171
{% endtabs %}
187172

188173
Here,
@@ -198,14 +183,14 @@ For **Azure OpenAI**, first [deploy an Azure OpenAI Service resource and model](
198183

199184
* Inside wwwroot, create an index.html host page for the Blazor UI. This host page is required by BlazorWebView to initialize the Blazor runtime and load static assets (themes and scripts). A basic index.html might look like the following:
200185

201-
202-
```html
186+
{% tabs %}
187+
{% highlight html tabtitle="wwwroot/index.html" hl_lines="8 13" %}
203188

204189
<!DOCTYPE html>
205190
<html>
206191
<head>
207192
<meta charset="utf-8" />
208-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
193+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
209194
<title>WPF Blazor Hybrid App</title>
210195
<base href="/" />
211196
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
@@ -217,7 +202,10 @@ For **Azure OpenAI**, first [deploy an Azure OpenAI Service resource and model](
217202
</body>
218203
</html>
219204

220-
```
205+
{% endhighlight %}
206+
{% endtabs %}
207+
208+
N> Ensure that the smart pdfviewer static assets (themes and scripts) are loaded properly.
221209

222210
## Adding Blazor Smart PDF Viewer component
223211

@@ -240,15 +228,13 @@ Create a Razor component (for example, Main.razor) in the project and add the Sy
240228
* Add the Microsoft.AspNetCore.Components.WebView.Wpf namespace.
241229
* Embed the BlazorWebView control, set HostPage to wwwroot/index.html, and map a RootComponent that matches the Razor component type and the selector in index.html (#app).
242230

243-
```xaml
231+
{% tabs %}
232+
{% highlight xaml tabtitle="MainWindow.xaml" hl_lines="3 7 8 9 11 12" %}
233+
244234
<Window x:Class="WPFBlazorHybridApp.MainWindow"
245-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
246-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
247-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
248-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
235+
....
249236
xmlns:blazor="clr-namespace:Microsoft.AspNetCore.Components.WebView.Wpf;assembly=Microsoft.AspNetCore.Components.WebView.Wpf"
250-
xmlns:local="clr-namespace:WPFBlazorHybridApp"
251-
mc:Ignorable="d"
237+
....
252238
Title="MainWindow" Height="450" Width="800">
253239
<Grid>
254240
<blazor:BlazorWebView HostPage="wwwroot\index.html" Services="{DynamicResource services}">
@@ -260,7 +246,8 @@ Create a Razor component (for example, Main.razor) in the project and add the Sy
260246
</Grid>
261247
</Window>
262248

263-
```
249+
{% endhighlight %}
250+
{% endtabs %}
264251

265252
## Run the application
266253

@@ -272,6 +259,9 @@ Run the WPF application. The Syncfusion&reg; Blazor Smart PDF Viewer renders ins
272259
273260
## See also
274261

262+
* [Getting Started with Blazor Smart PDF Viewer Component in Blazor Web App](./web-app)
263+
* [Getting Started with Blazor Smart PDF Viewer Component in WinForms Blazor Hybrid App](./winforms-blazor-app)
264+
* [Getting Started with Blazor Smart PDF Viewer Component in MAUI Blazor App](./maui-blazor-app)
275265
* [Document Summarizer in Blazor Smart PDF Viewer](../document-summarizer)
276266
* [Smart Redaction in Blazor Smart PDF Viewer](../smart-redaction)
277267
* [Smart Fill in Blazor Smart PDF Viewer](../smart-fill).
37.5 KB
Loading
39.5 KB
Loading

0 commit comments

Comments
 (0)