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/PDF-Viewer/angular/getting-started-with-server-backed.md
+65-44Lines changed: 65 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
---
2
2
layout: post
3
-
title: Getting started with Angular PDF Viewer component | Syncfusion
4
-
description: Checkout and learn about Getting started with Angular PDF Viewer component of Syncfusion Essential JS 2 and more details.
3
+
title: Getting started with Angular PDF Viewer (server-backed) | Syncfusion
4
+
description: Learn how to set up and use the Syncfusion Angular PDF Viewer in server-backed mode, including module injection and web service configuration.
5
5
platform: document-processing
6
6
control: PDF Viewer
7
7
documentation: ug
8
8
domainurl: ##DomainURL##
9
9
---
10
10
11
-
# Getting started with PDF Viewer component
11
+
# Getting started with Angular PDF Viewer (server-backed)
12
12
13
-
This section explains the steps required to create a simple Angular PDF Viewer and demonstrates the basic usage of the PDF Viewer control in a Angular CLI application.
13
+
This guide explains how to create the PDF Viewer component and configure its features in Angular using the Essential JS 2 in server-backed mode.
14
14
15
-
## Setup Angular Environment
15
+
## Set up the development environment
16
16
17
17
You can use the [`Angular CLI`](https://github.com/angular/angular-cli) to setup your Angular applications.
18
18
To install the latest Angular CLI globally use the following command.
@@ -21,9 +21,7 @@ To install the latest Angular CLI globally use the following command.
21
21
npm install -g @angular/cli
22
22
```
23
23
24
-
N> Use the command **npm install --save @angular/cli@12.0.2** to install the Angular CLI version 12.0.2
25
-
26
-
## Create an Angular Application
24
+
## Create an Angular application
27
25
28
26
Start a new Angular application using the Angular CLI command as follows.
29
27
@@ -32,15 +30,31 @@ ng new my-app
32
30
cd my-app
33
31
```
34
32
35
-
## Installing Syncfusion<supstyle="font-size:70%">®</sup> PDF Viewer package
33
+
## Add Syncfusion JavaScript packages
36
34
37
-
All the available Essential<supstyle="font-size:70%">®</sup> JS 2 packages are published in `npmjs.com` registry. To install PDF Viewer component, use the following command.
35
+
All the available EssentialJS 2 packages are published in the [npmjs.com](https://www.npmjs.com/~syncfusionorg) public registry. To install PDF Viewer component, use the following command.
Add the Angular PDF Viewer by using `<ejs-pdfviewer>` selector in `template` section of the `src/app/app.component.ts` file to render the PDF Viewer component.
90
86
91
87
```typescript
@@ -118,7 +114,7 @@ export class AppComponent implements OnInit {
118
114
}
119
115
}
120
116
```
121
-
N> The Web API hosted link https://document.syncfusion.com/web-services/pdf-viewer/api/pdfviewer utilized in the PDF viewer's serviceUrl property is intended solely for demonstration and evaluation purposes. For production deployment, please host your own web service with your required server configurations. You can refer and reuse the [GitHub Web Service example](https://github.com/SyncfusionExamples/EJ2-PDFViewer-WebServices) or [Docker image](https://hub.docker.com/r/syncfusion/pdfviewer-server) for hosting your own web service and use for the serviceUrl property. **We strongly recommend using the standalone mode.**
117
+
N> The Web API link https://document.syncfusion.com/web-services/pdf-viewer/api/pdfviewer/ used in the `serviceUrl` property is intended for demonstration and evaluation only. For production, host your own web service with the required server configuration. You can reuse the [GitHub web service example](https://github.com/SyncfusionExamples/EJ2-PDFViewer-WebServices) or [Docker image](https://hub.docker.com/r/syncfusion/pdfviewer-server). **Standalone mode is strongly recommended.**
> For PDF Viewer serviceUrl creation, follow the steps provided in the [link](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/javascript-es6/how-to/create-pdfviewer-service)
160
156
161
-
## How to run the PDF Viewer web service
157
+
## Module injection
158
+
159
+
To enable additional features, inject the required modules. The following modules extend the PDF Viewer's functionality:
Inject modules using the `providers` property in `@NgModule`.
162
176
163
-
1. Download the sample from the [Web service sample in GitHub](https://github.com/SyncfusionExamples/EJ2-PDFViewer-WebServices) link.
177
+
> To create a PDF Viewer `serviceUrl`, follow the steps in [Create PDF Viewer service](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/javascript-es6/how-to/create-pdfviewer-service).
164
178
165
-
2. Navigate to the `ASP.NET Core` folder and open it in the command prompt.
179
+
## Run the PDF Viewer web service
180
+
181
+
1. Download the sample from the [web service sample in GitHub](https://github.com/SyncfusionExamples/EJ2-PDFViewer-WebServices).
182
+
183
+
2. Navigate to the `ASP.NET Core` folder and open it in a command prompt.
166
184
167
185
3. Navigate to the appropriate subfolder based on your .NET version:
168
186
169
187
- .NET 6.0 → `PdfViewerWebService_6.0`
170
188
- .NET 8.0 → `PdfViewerWebService_8.0`
171
189
172
-
4.Use the below command to restore the required packages.
190
+
4.Restore packages:
173
191
174
-
```sh
175
-
dotnet restore
176
-
```
192
+
```
193
+
dotnet restore
194
+
```
177
195
178
-
5.Use the below command to run the web service.
196
+
5.Run the web service:
179
197
180
-
```sh
181
-
dotnet run
182
-
```
198
+
```
199
+
dotnet run
200
+
```
183
201
184
-
6.You can see that the PDF Viewer server instance runs in the local host with the port number `localhost:5001`and navigate to the PDF Viewer Web control `localhost:5001/pdfviewer`which returns the default get response method. We can bind the link to the `serviceUrl` property of PDF Viewer as below.
202
+
6.The PDF Viewer server instance runs at `https://localhost:5001`. Navigate to `https://localhost:5001/pdfviewer` to see the default GET response. Bind this URL to the `serviceUrl` property of the PDF Viewer as shown below.
N> When configuring the server-backed PDF viewer, it's Essential<sup style="font-size:70%">®</sup> to understand that there is no need to include the pdfium.js and pdfium.wasm files. Unlike the standalone PDF viewer, which relies on these files for local rendering, the server-backed PDF viewer fetches and renders PDFs directly from the server. Consequently, you can exclude the copy command for deployment process, as they are not required to load and display PDFs in this context.
194
211
195
-
N> For hosting the web service on the Linux platform, ensure to include the [SkiaSharp.NativeAssets.Linux](https://nuget.org/packages/SkiaSharp.NativeAssets.Linux/3.116.1). Additionally, for AWS environments, utilize the following packages:
212
+
N> In server-backed mode, do not include `pdfium.js` and `pdfium.wasm`. Unlike standalone mode, the server-backed PDF Viewer renders PDFs on the server. These files and their copy steps are not required for deployment in this context.
213
+
214
+
> Refer to the [Angular PDF Viewer feature tour](https://www.syncfusion.com/pdf-viewer-sdk) for an overview of capabilities. Explore the [Angular PDF Viewer example](https://document.syncfusion.com/demos/pdf-viewer/angular/#/tailwind3/pdfviewer/default.html) to see core features in action.
215
+
216
+
N> For hosting the web service on Linux, include [SkiaSharp.NativeAssets.Linux](https://nuget.org/packages/SkiaSharp.NativeAssets.Linux/3.116.1). For AWS environments, use the following packages:
196
217
197
218
| **Amazon Web Services (AWS)** |**NuGet package name** |
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Viewer/angular/getting-started.md
+27-4Lines changed: 27 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ domainurl: ##DomainURL##
10
10
11
11
# Getting started with Standalone PDF Viewer component
12
12
13
-
This section explains the steps required to create a simple Standalone Angular PDF Viewer and demonstrates the basic usage of the PDF Viewer control in a Angular CLI application (for Angular versions below 17).
13
+
This section explains the steps required to create a simple Standalone Angular PDF Viewer and demonstrates the basic usage of the PDF Viewer control in an Angular CLI application.
14
14
15
15
N> For Angular 17+, see the following links:
16
16
@@ -87,7 +87,7 @@ export class AppModule { }
87
87
88
88
## Adding CSS reference
89
89
90
-
Add the Angular PDF Viewer component’s styles as given below in `src/styles.css` file.
90
+
Add the Angular PDF Viewer component's styles as given below in `src/styles.css` file.
Add the Angular PDF Viewer by using `<ejs-pdfviewer>` selector in `template` section of the `src/app/app.component.ts` file to render the PDF Viewer component.
107
107
@@ -135,7 +135,8 @@ export class AppComponent implements OnInit {
135
135
}
136
136
}
137
137
```
138
-
### Steps to Load PDF Viewer with Local Resources
138
+
139
+
### Load PDF Viewer with local resources
139
140
140
141
To configure the PDF Viewer to use local files for `documentPath` and `resourceUrl` instead of files hosted on a CDN, follow these steps:
Inject modules using the `providers` array in the component or module.
239
+
240
+
> Refer to the [Angular PDF Viewer feature tour](https://www.syncfusion.com/pdf-viewer-sdk/angular-pdf-viewer) for an overview of capabilities. Explore the [Angular PDF Viewer example](https://document.syncfusion.com/demos/pdf-viewer/angular/#/tailwind3/pdfviewer/default) to see core features in action.
241
+
219
242
[View sample in GitHub](https://github.com/SyncfusionExamples/angular-pdf-viewer-examples/tree/master/Getting%20started%20-%20Standalone).
0 commit comments