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-Library/javascript/Bookmarks.md
+42-44Lines changed: 42 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,28 +7,28 @@ documentation: UG
7
7
---
8
8
# Bookmarks in JavaScript PDF library
9
9
10
-
Syncfusion<sup>®</sup> PDF provides support to insert, remove and modify the bookmarks in the PDF Document.
10
+
Syncfusion<sup>®</sup> PDF provides support to insert, remove, and modify the bookmarks in the PDF Document.
11
11
12
-
## Adding Bookmarks in a PDF
12
+
## Adding bookmarks to a PDF
13
13
14
14
This example demonstrates how to add bookmarks to a PDF document using the `PdfBookmark` class. Bookmarks provide an easy way to navigate through different sections of a PDF file.
15
15
16
16
{% tabs %}
17
-
{% highlight javascript tabtitle="TypeScript" %}
18
-
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
17
+
{% highlight typescript tabtitle="TypeScript" %}
18
+
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfBookmark, PdfDestination} from '@syncfusion/ej2-pdf';
19
19
20
20
// Create a new PDF document
21
21
let document: PdfDocument = new PdfDocument();
22
-
// Add page
22
+
// Add a page
23
23
let page: PdfPage = document.addPage();
24
24
// Get the bookmarks
25
25
let bookmarks: PdfBookmarkBase = document.bookmarks;
26
-
// Add a new outline to the PDF document
26
+
// Add a new bookmark to the PDF document
27
27
let bookmark: PdfBookmark = bookmarks.add('Introduction');
28
28
// Sets destination to the bookmark
29
29
bookmark.destination = new PdfDestination(page, { x: 100, y: 200 });
30
30
// Save the document
31
-
document.save('Output.pdf');
31
+
document.save('output.pdf');
32
32
// Close the document
33
33
document.destroy();
34
34
@@ -37,42 +37,42 @@ document.destroy();
37
37
38
38
// Create a new PDF document
39
39
var document = new ej.pdf.PdfDocument();
40
-
// Add page
40
+
// Add a page
41
41
var page = document.addPage();
42
42
// Get the bookmarks
43
43
var bookmarks = document.bookmarks;
44
-
// Add a new outline to the PDF document
44
+
// Add a new bookmark to the PDF document
45
45
var bookmark = bookmarks.add('Introduction');
46
46
// Set destination to the bookmark
47
47
bookmark.destination = new ej.pdf.PdfDestination(page, { x: 100, y: 200 });
48
48
// Save the document
49
-
document.save('Output.pdf');
49
+
document.save('output.pdf');
50
50
// Close the document
51
51
document.destroy();
52
52
53
53
{% endhighlight %}
54
54
{% endtabs %}
55
55
56
-
## Inserting Bookmarks in an existing PDF
56
+
## Inserting bookmarks into an existing PDF
57
57
58
58
This example demonstrates how to insert bookmarks at a specific position in an existing PDF document using the `PdfBookmark` class. This feature allows precise control over bookmark order.
59
59
60
60
{% tabs %}
61
-
{% highlight javascript tabtitle="TypeScript" %}
62
-
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
61
+
{% highlight typescript tabtitle="TypeScript" %}
62
+
import {PdfDocument, PdfPage, PdfBookmark, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
63
63
64
64
// Load an existing PDF document
65
65
let document: PdfDocument = new PdfDocument(data);
66
66
// Get the first page
67
67
let page: PdfPage = document.getPage(0) as PdfPage;
68
68
// Get the bookmarks
69
69
let bookmarks: PdfBookmarkBase = document.bookmarks;
70
-
// Add a new bookmark at the specified page index
70
+
// Add a new bookmark at the specified bookmark index
71
71
let bookmark: PdfBookmark = bookmarks.add('Introduction', 1);
72
72
// Sets destination to the bookmark
73
73
bookmark.destination = new PdfDestination(page, { x: 100, y: 200 });
74
74
// Save the document
75
-
document.save('Output.pdf');
75
+
document.save('output.pdf');
76
76
// Close the document
77
77
document.destroy();
78
78
@@ -85,23 +85,23 @@ var document = new ej.pdf.PdfDocument(data);
85
85
var page = document.getPage(0);
86
86
// Get the bookmarks
87
87
var bookmarks = document.bookmarks;
88
-
// Add a new bookmark at the specified page index
88
+
// Add a new bookmark at the specified bookmark index
89
89
var bookmark = bookmarks.add('Introduction', 1);
90
90
// Set destination to the bookmark
91
91
bookmark.destination = new ej.pdf.PdfDestination(page, { x: 100, y: 200 });
92
92
// Save the document
93
-
document.save('Output.pdf');
93
+
document.save('output.pdf');
94
94
// Close the document
95
95
document.destroy();
96
96
97
97
{% endhighlight %}
98
98
{% endtabs %}
99
99
100
-
## Removing Bookmarks from an existing PDF
100
+
## Removing bookmarks from an existing PDF
101
101
102
102
This example demonstrates how to remove bookmarks from an existing PDF document using the `PdfBookmark` class.
103
103
{% tabs %}
104
-
{% highlight javascript tabtitle="TypeScript" %}
104
+
{% highlight typescript tabtitle="TypeScript" %}
105
105
import {PdfDocument, PdfPage, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
106
106
107
107
// Load an existing PDF document
@@ -113,7 +113,7 @@ let bookmarks: PdfBookmarkBase = document.bookmarks;
113
113
// Remove specified bookmark from the document.
114
114
bookmarks.remove('Introduction');
115
115
// Save the document
116
-
document.save('Output.pdf');
116
+
document.save('output.pdf');
117
117
// Close the document
118
118
document.destroy();
119
119
@@ -129,31 +129,29 @@ var bookmarks = document.bookmarks;
129
129
// Remove specified bookmark from the document
130
130
bookmarks.remove('Introduction');
131
131
// Save the document
132
-
document.save('Output.pdf');
132
+
document.save('output.pdf');
133
133
// Close the document
134
134
document.destroy();
135
135
136
136
{% endhighlight %}
137
137
{% endtabs %}
138
138
139
-
## Removing Bookmark from the document at the specified index
139
+
## Removing a bookmark from the document at a specified index
140
140
141
141
This example demonstrates how to remove bookmarks from the document at the specific index using the `PdfBookmark` class.
142
142
143
143
{% tabs %}
144
-
{% highlight javascript tabtitle="TypeScript" %}
145
-
import {PdfDocument, PdfPage, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
144
+
{% highlight typescript tabtitle="TypeScript" %}
145
+
import {PdfDocument, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
146
146
147
147
// Load an existing PDF document
148
148
let document: PdfDocument = new PdfDocument(data);
149
-
// Get the first page
150
-
let page: PdfPage = document.getPage(0) as PdfPage;
151
149
// Get the bookmarks
152
150
let bookmarks: PdfBookmarkBase = document.bookmarks;
153
151
// Remove the bookmark from the document at the index 1.
154
152
bookmarks.remove(1);
155
153
// Save the document
156
-
document.save('Output.pdf');
154
+
document.save('output.pdf');
157
155
// Close the document
158
156
document.destroy();
159
157
@@ -162,26 +160,24 @@ document.destroy();
162
160
163
161
// Load an existing PDF document
164
162
var document = new ej.pdf.PdfDocument(data);
165
-
// Get the first page
166
-
var page = document.getPage(0);
167
163
// Get the bookmarks
168
164
var bookmarks = document.bookmarks;
169
165
// Remove the bookmark from the document at index 1
170
166
bookmarks.remove(1);
171
167
// Save the document
172
-
document.save('Output.pdf');
168
+
document.save('output.pdf');
173
169
// Close the document
174
170
document.destroy();
175
171
176
172
{% endhighlight %}
177
173
{% endtabs %}
178
174
179
-
## Removing all the Bookmark from the collection
175
+
## Removing all bookmarks from the collection
180
176
181
-
This example demonstrates how to removes all the bookmarks from the collection using the `PdfBookmark` class.
177
+
This example demonstrates how to removes all bookmarks from the collection using the `PdfBookmark` class.
182
178
183
179
{% tabs %}
184
-
{% highlight javascript tabtitle="TypeScript" %}
180
+
{% highlight typescript tabtitle="TypeScript" %}
185
181
import {PdfDocument, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
186
182
187
183
// Load an existing PDF document
@@ -190,10 +186,10 @@ let document: PdfDocument = new PdfDocument(data);
190
186
let bookmarks: PdfBookmarkBase = document.bookmarks;
191
187
// Remove all the bookmark from the collection.
192
188
bookmarks.clear();
193
-
// Get count after removal of all outlines.
189
+
// // Get the count after removal of all bookmarks
194
190
let count: number = bookmarks.count;
195
191
// Save the document
196
-
document.save('Output.pdf');
192
+
document.save('output.pdf');
197
193
// Destroy the document
198
194
document.destroy();
199
195
@@ -206,32 +202,34 @@ var document = new ej.pdf.PdfDocument(data);
206
202
var bookmarks = document.bookmarks;
207
203
// Remove all the bookmarks from the collection
208
204
bookmarks.clear();
209
-
// Get count after removal of all outlines
205
+
// // Get the count after removal of all bookmarks
210
206
var count = bookmarks.count;
211
207
// Save the document
212
-
document.save('Output.pdf');
208
+
document.save('output.pdf');
213
209
// Destroy the document
214
210
document.destroy();
215
211
216
212
{% endhighlight %}
217
213
{% endtabs %}
218
214
219
-
## Bookmark page index in an existing PDF document
215
+
## Getting a bookmark's page index in an existing PDF document
220
216
221
217
This example demonstrates how to retrieve the page index associated with a bookmark in an existing PDF document using the `PdfBookmark` class. This helps identify the exact location of the bookmark.
222
218
223
219
{% tabs %}
224
-
{% highlight javascript tabtitle="TypeScript" %}
220
+
{% highlight typescript tabtitle="TypeScript" %}
225
221
import {PdfDocument, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
226
222
227
223
// Load an existing PDF document
228
224
let document: PdfDocument = new PdfDocument(data);
229
225
// Get bookmarks
230
-
let bookmarks: PdfBookmarkBase = document.bookmarks;
231
-
// Get bookmark at the specified index
232
-
let pageIndex: number = bookmarks.destination.pageIndex;
226
+
let bookmarks: PdfBookmarkBase = document.bookmarks;
227
+
// Get the first bookmark (or any specific one)
228
+
let bookmark = bookmarks.at(0);
229
+
// Get the page index of the bookmark's destination
230
+
let pageIndex: number = bookmark.destination.pageIndex;
233
231
// Save the document
234
-
document.save('Output.pdf');
232
+
document.save('output.pdf');
235
233
// Close the document
236
234
document.destroy();
237
235
@@ -247,7 +245,7 @@ var bookmark = bookmarks.at(0);
247
245
// Get the page index of the bookmark's destination
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-angular.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ documentation: ug
8
8
keywords: angular create pdf, angular generate pdf, angular pdf library, ej2 pdf angular, JavaScript
9
9
---
10
10
11
-
# Create or Generate PDF file in Angular application
11
+
# Create or generate PDF file in Angular application
12
12
13
13
The Syncfusion<sup>®</sup> JavaScript PDF library is used to create, read, and edit PDF documents. This library also offers functionality to merge, split, stamp, fill forms, and secure PDF files.
14
14
@@ -23,7 +23,7 @@ To install the latest Angular CLI globally use the following command.
23
23
npm install -g @angular/cli
24
24
```
25
25
26
-
N> Use the command **npm install --save @angular/cli@12.0.2** to install the Angular CLI version 12.0.2
26
+
N> To install a specific Angular CLI version, use: **npm install --save @angular/cli@12.0.2**
27
27
28
28
## Create an Angular Application
29
29
@@ -36,7 +36,7 @@ cd my-app
36
36
37
37
## Installing Syncfusion<sup>®</sup> JavaScript PDF package
38
38
39
-
All the available JS 2 packages are published in `npmjs.com` registry.
39
+
All Syncfusion<sup>®</sup> JS 2 packages are published in `npmjs.com` registry.
40
40
41
41
* To install PDF component, use the following command.
* Confirm that there is an 'openjpeg' directory within your public directory, if you extracting images from PDF.
52
-
*Validate that your server has been configured to utilize the Content-Type: application/wasm MIME type.
51
+
* Confirm that there is an `openjpeg` directory within your src/assets directory if you are extracting images from PDFs.
52
+
*Ensure your server serves .wasm files with the Content-Type: application/wasm MIME type (Angular dev server handles this by default; configure your production server accordingly).
53
53
54
-
## Create a PDF document using TypeScript
54
+
## Create a PDF document
55
55
56
56
* Add a simple button to `app.component.html` and attach a click handler that uses the TypeScript PDF API to create a new PDF document.
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-asp-net-core.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,11 @@ keywords: .net core create pdf, edit pdf, merge, pdf form, fill form, digital si
10
10
11
11
# Create or Generate PDF in ASP.NET Core
12
12
13
-
The Syncfusion<sup>®</sup> JavaScript PDF library is used to create, read, and edit PDF documents. This library also offers functionality to merge, split, stamp, forms, and secure PDF files.
13
+
The Syncfusion<sup>®</sup> JavaScript PDF library is used to create, read, and edit PDF documents. This library also offers functionality to merge, split, stamp, fill forms, and secure PDF files.
14
14
15
15
This guide explains how to integrate the JavaScript PDF library into an ASP.NET Core application.
16
16
17
-
## Integrate PDF library into an ASP.NET Core application
17
+
## Integrate the PDF library into an ASP.NET Core application
18
18
19
19
Step 1: Start Visual Studio and select **Create a new project**.
20
20
Step 2: In the **Create a new project** dialog, select **ASP.NET Core Web App**.
@@ -24,7 +24,7 @@ Step 3: In the **Configure your new project** dialog, enter the project name and
24
24
Step 4: In the **Additional information** dialog, select a .NET LTS version (for example, **.NET 8.0 (Long-term Support)**) and then select **Create**.
25
25

26
26
27
-
Step 5: **Add script reference**: Add the required scripts using the CDN inside the `<head>` of `~/Views/Shared/_Layout.cshtml` as follows:
27
+
Step 5: **Add script reference**: Add the required scripts using the CDN inside the `<head>` of `~/Views/Shared/_Layout.cshtml` as follows:
And ensure the application includes an `openjpeg` folder under `wwwroot` (or a publicly accessible static path). This folder must contain the `openjpeg.js` and `openjpeg.wasm` files, along with the PDF file to extract images. Keep these in the same static content area as `ej2.min.js`.
43
43
44
-
Step 6: **Create a PDF document**: Add the script in `~/Views/Home/Index.cshtml` by creating a button and attaching a click event that uses the JavaScript PDF API to generate a PDF document.
44
+
Step 6: **Create a PDF document**: Add the script in `~/Views/Home/Index.cshtml` by creating a button and attaching a click event that uses the JavaScript PDF API to generate a PDF document.
0 commit comments