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
+51-48Lines changed: 51 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,13 @@ domainurl: ##DomainURL##
10
10
11
11
# Getting started with Angular PDF Viewer (server-backed)
12
12
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.
13
+
This guide explains how to create the PDF Viewer component and configure its features in Angular 21 using the Essential JS 2 in server-backed mode.
14
+
15
+
> Note: This guide supports **Angular 21** and other recent Angular versions. For detailed compatibility with other Angular versions, please refer to the [Angular version support matrix](https://ej2.syncfusion.com/angular/documentation/system-requirement#angular-version-compatibility). Starting from Angular 19, standalone components are the default, and this guide reflects that architecture.
16
+
17
+
## Prerequisites
18
+
19
+
Ensure your development environment meets the [System Requirements for Syncfusion<supstyle="font-size:70%">®</sup> Angular UI Components](https://ej2.syncfusion.com/angular/documentation/system-requirement).
14
20
15
21
## Set up the development environment
16
22
@@ -21,16 +27,51 @@ To install the latest Angular CLI globally use the following command.
21
27
npm install -g @angular/cli
22
28
```
23
29
30
+
> **Angular 21 Standalone Architecture:** Standalone components are the default in Angular 21. This guide uses the modern standalone architecture. If you need more information about the standalone architecture, refer to the [Standalone Guide](https://ej2.syncfusion.com/angular/documentation/getting-started/angular-standalone).
31
+
32
+
### Installing a specific version
33
+
34
+
To install a particular version of Angular CLI, use:
35
+
36
+
```bash
37
+
npm install -g @angular/cli@21.0.0
38
+
```
39
+
24
40
## Create an Angular application
25
41
26
42
Start a new Angular application using the Angular CLI command as follows.
27
43
28
44
```bash
29
45
ng new my-app
46
+
```
47
+
48
+
* This command will prompt you to configure settings like enabling Angular routing and choosing a stylesheet format.
* By default, a CSS-based application is created. Use SCSS if required:
53
+
54
+
```bash
55
+
ng new my-app --style=scss
56
+
```
57
+
58
+
* During project setup, when prompted for the Server-side rendering (SSR) option, choose the appropriate configuration.
59
+
60
+

61
+
62
+
* Select the required AI tool or 'none' if you do not need any AI tool.
63
+
64
+

65
+
66
+
* Navigate to your newly created application directory:
67
+
68
+
```bash
30
69
cd my-app
31
70
```
32
71
33
-
## Add Syncfusion JavaScript packages
72
+
> Note: In Angular 19 and below, it uses `app.component.ts`, `app.component.html`, `app.component.css` etc. In Angular 20+, the CLI generates a simpler structure with `src/app/app.ts`, `app.html`, and `app.css` (no `.component.` suffixes).
73
+
74
+
## Installing Syncfusion<supstyle="font-size:70%">®</sup> PDF Viewer package
34
75
35
76
All the available Essential JS 2 packages are published in the [npmjs.com](https://www.npmjs.com/~syncfusionorg) public registry. To install PDF Viewer component, use the following command.
36
77
@@ -56,33 +97,7 @@ Add the component CSS in the `~/src/styles.css` file, as shown below:
56
97
57
98
## Add the PDF Viewer component
58
99
59
-
Import PDF Viewer module into Angular application(app.module.ts) from the package `@syncfusion/ej2-angular-pdfviewer`[src/app/app.module.ts].
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.
100
+
Add the Angular PDF Viewer by using `<ejs-pdfviewer>` selector in `template` section of the `src/app/app.ts` file to render the PDF Viewer component.
@@ -199,11 +202,11 @@ Inject modules using the `providers` property in `@NgModule`.
199
202
dotnet run
200
203
```
201
204
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.
205
+
6. The PDF Viewer server instance runs at `https://localhost:7255`. Navigate to `https://localhost:7255/pdfviewer` to see the default GET response. Bind this URL to the `serviceUrl` property of the PDF Viewer as shown below.
203
206
204
207
```javascript
205
-
exportclassAppComponentimplements OnInit {
206
-
public service ='https://localhost:5001/pdfviewer';
208
+
exportclassAppimplements OnInit {
209
+
public service ='https://localhost:7255/pdfviewer';
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Viewer/angular/getting-started.md
+62-43Lines changed: 62 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,19 @@ domainurl: ##DomainURL##
10
10
11
11
# Getting started with Angular 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 an Angular CLI application.
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 21.
14
14
15
-
N> For Angular 17+, see the following links:
15
+
> Note: This guide supports **Angular 21** and other recent Angular versions. For detailed compatibility with other Angular versions, please refer to the [Angular version support matrix](https://ej2.syncfusion.com/angular/documentation/system-requirement#angular-version-compatibility). Starting from Angular 19, standalone components are the default, and this guide reflects that architecture.
16
+
17
+
N> For older versions of Angular, see the following links:
16
18
17
19
*[Create a Standalone PDF Viewer in Angular 17 and above with-no-standalone-flag](./how-to/create-a-standalone-pdf-viewer-in-angular-17-and-above-with-no-standalone-flag).
18
20
*[Create a Standalone PDF Viewer in Angular 17 and above without --no-standalone flag](./how-to/create-a-standalone-pdf-viewer-in-angular-17-and-above-without-no-standalone-flag).
19
21
22
+
## Prerequisites
23
+
24
+
Ensure your development environment meets the [System Requirements for Syncfusion<supstyle="font-size:70%">®</sup> Angular UI Components](https://ej2.syncfusion.com/angular/documentation/system-requirement).
25
+
20
26
## Setup Angular Environment
21
27
22
28
You can use the [`Angular CLI`](https://github.com/angular/angular-cli) to setup your Angular applications.
@@ -26,17 +32,50 @@ To install the latest Angular CLI globally use the following command.
26
32
npm install -g @angular/cli
27
33
```
28
34
29
-
N> Use the command **npm install --save @angular/cli@12.0.2** to install the Angular CLI version 12.0.2
35
+
> **Angular 21 Standalone Architecture:** Standalone components are the default in Angular 21. This guide uses the modern standalone architecture. If you need more information about the standalone architecture, refer to the [Standalone Guide](https://ej2.syncfusion.com/angular/documentation/getting-started/angular-standalone).
36
+
37
+
### Installing a specific version
38
+
39
+
To install a particular version of Angular CLI, use:
40
+
41
+
```bash
42
+
npm install -g @angular/cli@21.0.0
43
+
```
30
44
31
45
## Create an Angular Application
32
46
33
47
Start a new Angular application using the Angular CLI command as follows.
34
48
35
49
```bash
36
50
ng new my-app
51
+
```
52
+
53
+
* This command will prompt you to configure settings like enabling Angular routing and choosing a stylesheet format.
* By default, a CSS-based application is created. Use SCSS if required:
58
+
59
+
```bash
60
+
ng new my-app --style=scss
61
+
```
62
+
63
+
* During project setup, when prompted for the Server-side rendering (SSR) option, choose the appropriate configuration.
64
+
65
+

66
+
67
+
* Select the required AI tool or 'none' if you do not need any AI tool.
68
+
69
+

70
+
71
+
* Navigate to your newly created application directory:
72
+
73
+
```bash
37
74
cd my-app
38
75
```
39
76
77
+
> Note: In Angular 19 and below, it uses `app.component.ts`, `app.component.html`, `app.component.css` etc. In Angular 20+, the CLI generates a simpler structure with `src/app/app.ts`, `app.html`, and `app.css` (no `.component.` suffixes).
78
+
40
79
## Installing Syncfusion<supstyle="font-size:70%">®</sup> PDF Viewer package
41
80
42
81
All the available Essential<supstyle="font-size:70%">®</sup> JS 2 packages are published in `npmjs.com` registry.
* Confirm that there is an 'ej2-pdfviewer-lib' directory within your public directory, housing the assets of the PDF Viewer library.
95
+
* Confirm that there is an 'ej2-pdfviewer-lib' directory within your `src/assets` directory, housing the assets of the PDF Viewer library.
57
96
58
97
* Validate that your server has been configured to utilize the Content-Type: application/wasm MIME type. Additional information can be found in the [Troubleshooting](./troubleshooting/troubleshooting) section.
59
98
60
-
## Registering PDF Viewer Module
61
-
62
-
Import PDF Viewer module into Angular application(app.module.ts) from the package `@syncfusion/ej2-angular-pdfviewer`[src/app/app.module.ts].
Add the Angular PDF Viewer component's styles as given below in `src/styles.css` file.
@@ -103,7 +114,7 @@ Add the Angular PDF Viewer component's styles as given below in `src/styles.css`
103
114
104
115
## Add the PDF Viewer component
105
116
106
-
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.
117
+
Add the Angular PDF Viewer by using `<ejs-pdfviewer>` selector in `template` section of the `src/app/app.ts` file to render the PDF Viewer component.
public document:string='https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
133
145
public resource:string="https://cdn.syncfusion.com/ej2/26.2.11/dist/ej2-pdfviewer-lib";
134
146
ngOnInit():void {
@@ -142,7 +154,14 @@ To configure the PDF Viewer to use local files for `documentPath` and `resourceU
142
154
143
155
**Step 1:** Ensure that your application includes the `ej2-pdfviewer-lib` folder. This folder must contain the `pdfium.js`, `pdfium.wasm` files, and the PDF file that you intend to display. These should be located in the `assets` directory within your project's `src` folder.
144
156
145
-
**Step 2:** Assign local file paths to the `documentPath` and `resourceUrl` properties within the PDF Viewer setup. The `documentPath` should refer to your PDF file, while the `resourceUrl` should point to the directory containing the supporting resources.
157
+
**Step 2:** Register the assets folder inside `angular.json`
158
+
```json
159
+
"assets": [
160
+
"src/assets"
161
+
]
162
+
```
163
+
164
+
**Step 3:** Assign local file paths to the `documentPath` and `resourceUrl` properties within the PDF Viewer setup. The `documentPath` should refer to your PDF file, while the `resourceUrl` should point to the directory containing the supporting resources.
146
165
147
166
By following these steps, you will configure your PDF Viewer to load the required resources locally. See the code snippet below for reference.
0 commit comments