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
@@ -14,28 +14,26 @@ Syncfusion<sup>®</sup> PDF provides support to insert, remove and modify the
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 c# tabtitle="TypeScript" %}
18
-
19
-
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
20
-
21
-
// Create a new PDF document
22
-
let document: PdfDocument = new PdfDocument();
23
-
// Add page
24
-
let page: PdfPage = document.addPage();
25
-
// Get the bookmarks
26
-
let bookmarks: PdfBookmarkBase = document.bookmarks;
27
-
// Add a new outline to the PDF document
28
-
let bookmark: PdfBookmark = bookmarks.add('Introduction');
29
-
// Sets destination to the bookmark
30
-
bookmark.destination = new PdfDestination(page, {x: 100, y: 200});
31
-
// Save the document
32
-
document.save('Output.pdf');
33
-
// Close the document
34
-
document.destroy();
17
+
{% highlight javascript tabtitle="TypeScript" %}
18
+
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
35
19
36
-
{% endhighlight %}
37
-
{% highlight c# tabtitle="JavaScript" %}
20
+
// Create a new PDF document
21
+
let document: PdfDocument = new PdfDocument();
22
+
// Add page
23
+
let page: PdfPage = document.addPage();
24
+
// Get the bookmarks
25
+
let bookmarks: PdfBookmarkBase = document.bookmarks;
26
+
// Add a new outline to the PDF document
27
+
let bookmark: PdfBookmark = bookmarks.add('Introduction');
28
+
// Sets destination to the bookmark
29
+
bookmark.destination = new PdfDestination(page, { x: 100, y: 200 });
30
+
// Save the document
31
+
document.save('Output.pdf');
32
+
// Close the document
33
+
document.destroy();
38
34
35
+
{% endhighlight %}
36
+
{% highlight javascript tabtitle="JavaScript" %}
39
37
// Create a new PDF document
40
38
var document = new ej.pdf.PdfDocument();
41
39
// Add page
@@ -59,30 +57,28 @@ document.destroy();
59
57
This example demonstrates how to add bookmarks to an existing PDF document using the `PdfBookmark` class. This allows you to enhance navigation in already created PDF document.
60
58
61
59
{% tabs %}
62
-
{% highlight c# tabtitle="TypeScript" %}
63
-
64
-
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
65
-
66
-
// Load an existing PDF document
67
-
let document: PdfDocument = new PdfDocument(data, password);
68
-
// Get page
69
-
let page: PdfPage = document.getPage(0);
70
-
// Get the bookmarks
71
-
let bookmarks: PdfBookmarkBase = document.bookmarks;
72
-
// Gets the bookmark at the specified index
73
-
let bookmark: PdfBookmark = bookmarks.at(0) as PdfBookmark;
74
-
// Set the destination
75
-
bookmark.destination = new PdfDestination(page, {x: 100, y: 200});
76
-
// Save the document
77
-
document.save('Output.pdf');
78
-
// Close the document
79
-
document.destroy();
60
+
{% highlight javascript tabtitle="TypeScript" %}
61
+
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
62
+
63
+
// Load an existing PDF document
64
+
let document: PdfDocument = new PdfDocument(data);
65
+
// Get page
66
+
let page: PdfPage = document.getPage(0);
67
+
// Get the bookmarks
68
+
let bookmarks: PdfBookmarkBase = document.bookmarks;
69
+
// Gets the bookmark at the specified index
70
+
let bookmark: PdfBookmark = bookmarks.at(0) as PdfBookmark;
71
+
// Set the destination
72
+
bookmark.destination = new PdfDestination(page, { x: 100, y: 200 });
73
+
// Save the document
74
+
document.save('Output.pdf');
75
+
// Close the document
76
+
document.destroy();
80
77
81
78
{% endhighlight %}
82
-
{% highlight c# tabtitle="JavaScript" %}
83
-
79
+
{% highlight javascript tabtitle="JavaScript" %}
84
80
// Load an existing PDF document
85
-
var document = new ej.pdf.PdfDocument(data, password);
81
+
var document = new ej.pdf.PdfDocument(data);
86
82
// Get page
87
83
var page = document.getPage(0);
88
84
// Get the bookmarks
@@ -104,30 +100,28 @@ document.destroy();
104
100
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.
105
101
106
102
{% tabs %}
107
-
{% highlight c# tabtitle="TypeScript" %}
108
-
109
-
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
110
-
111
-
// Load an existing PDF document
112
-
let document: PdfDocument = new PdfDocument(data, password);
113
-
// Get the first page
114
-
let page: PdfPage = document.getPage(0) as PdfPage;
115
-
// Get the bookmarks
116
-
let bookmarks: PdfBookmarkBase = document.bookmarks;
117
-
// Add a new outline to the PDF document
118
-
let bookmark: PdfBookmark = bookmarks.add('Introduction', 1);
119
-
// Sets destination to the bookmark
120
-
bookmark.destination = new PdfDestination(page, {x: 100, y: 200});
121
-
// Save the document
122
-
document.save('Output.pdf');
123
-
// Close the document
124
-
document.destroy();
103
+
{% highlight javascript tabtitle="TypeScript" %}
104
+
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
125
105
126
-
{% endhighlight %}
127
-
{% highlight c# tabtitle="JavaScript" %}
106
+
// Load an existing PDF document
107
+
let document: PdfDocument = new PdfDocument(data);
108
+
// Get the first page
109
+
let page: PdfPage = document.getPage(0) as PdfPage;
110
+
// Get the bookmarks
111
+
let bookmarks: PdfBookmarkBase = document.bookmarks;
112
+
// Add a new outline to the PDF document
113
+
let bookmark: PdfBookmark = bookmarks.add('Introduction', 1);
114
+
// Sets destination to the bookmark
115
+
bookmark.destination = new PdfDestination(page, { x: 100, y: 200 });
116
+
// Save the document
117
+
document.save('Output.pdf');
118
+
// Close the document
119
+
document.destroy();
128
120
121
+
{% endhighlight %}
122
+
{% highlight javascript tabtitle="JavaScript" %}
129
123
// Load an existing PDF document
130
-
var document = new ej.pdf.PdfDocument(data, password);
124
+
var document = new ej.pdf.PdfDocument(data);
131
125
// Get the first page
132
126
var page = document.getPage(0);
133
127
// Get the bookmarks
@@ -148,28 +142,26 @@ document.destroy();
148
142
149
143
This example demonstrates how to remove bookmarks from an existing PDF document using the `PdfBookmark` class.
150
144
{% tabs %}
151
-
{% highlight c# tabtitle="TypeScript" %}
152
-
153
-
import {PdfDocument, PdfPage, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
154
-
155
-
// Load an existing PDF document
156
-
let document: PdfDocument = new PdfDocument(data, password);
157
-
// Get the first page
158
-
let page: PdfPage = document.getPage(0) as PdfPage;
159
-
// Get the bookmarks
160
-
let bookmarks: PdfBookmarkBase = document.bookmarks;
161
-
// Remove specified bookmark from the document.
162
-
bookmarks.remove('Introduction');
163
-
// Save the document
164
-
document.save('Output.pdf');
165
-
// Close the document
166
-
document.destroy();
145
+
{% highlight javascript tabtitle="TypeScript" %}
146
+
import {PdfDocument, PdfPage, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
167
147
168
-
{% endhighlight %}
169
-
{% highlight c# tabtitle="JavaScript" %}
148
+
// Load an existing PDF document
149
+
let document: PdfDocument = new PdfDocument(data);
150
+
// Get the first page
151
+
let page: PdfPage = document.getPage(0) as PdfPage;
152
+
// Get the bookmarks
153
+
let bookmarks: PdfBookmarkBase = document.bookmarks;
154
+
// Remove specified bookmark from the document.
155
+
bookmarks.remove('Introduction');
156
+
// Save the document
157
+
document.save('Output.pdf');
158
+
// Close the document
159
+
document.destroy();
170
160
161
+
{% endhighlight %}
162
+
{% highlight javascript tabtitle="JavaScript" %}
171
163
// Load an existing PDF document
172
-
var document = new ej.pdf.PdfDocument(data, password);
164
+
var document = new ej.pdf.PdfDocument(data);
173
165
// Get the first page
174
166
var page = document.getPage(0);
175
167
// Get the bookmarks
@@ -189,28 +181,26 @@ document.destroy();
189
181
This example demonstrates how to remove bookmarks from the document at the specific index using the `PdfBookmark` class.
190
182
191
183
{% tabs %}
192
-
{% highlight c# tabtitle="TypeScript" %}
193
-
194
-
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
195
-
196
-
// Load an existing PDF document
197
-
let document: PdfDocument = new PdfDocument(data, password);
198
-
// Get the first page
199
-
let page: PdfPage = document.getPage(0) as PdfPage;
200
-
// Get the bookmarks
201
-
let bookmarks: PdfBookmarkBase = document.bookmarks;
202
-
// Remove the bookmark from the document at the index 1.
203
-
bookmarks.remove(1);
204
-
// Save the document
205
-
document.save('Output.pdf');
206
-
// Close the document
207
-
document.destroy();
184
+
{% highlight javascript tabtitle="TypeScript" %}
185
+
import {PdfDocument, PdfPage, PdfBookmarkBase, PdfDestination} from '@syncfusion/ej2-pdf';
208
186
209
-
{% endhighlight %}
210
-
{% highlight c# tabtitle="JavaScript" %}
187
+
// Load an existing PDF document
188
+
let document: PdfDocument = new PdfDocument(data);
189
+
// Get the first page
190
+
let page: PdfPage = document.getPage(0) as PdfPage;
191
+
// Get the bookmarks
192
+
let bookmarks: PdfBookmarkBase = document.bookmarks;
193
+
// Remove the bookmark from the document at the index 1.
194
+
bookmarks.remove(1);
195
+
// Save the document
196
+
document.save('Output.pdf');
197
+
// Close the document
198
+
document.destroy();
211
199
200
+
{% endhighlight %}
201
+
{% highlight javascript tabtitle="JavaScript" %}
212
202
// Load an existing PDF document
213
-
var document = new ej.pdf.PdfDocument(data, password);
203
+
var document = new ej.pdf.PdfDocument(data);
214
204
// Get the first page
215
205
var page = document.getPage(0);
216
206
// Get the bookmarks
@@ -230,28 +220,26 @@ document.destroy();
230
220
This example demonstrates how to removes all the bookmarks from the collection using the `PdfBookmark` class.
231
221
232
222
{% tabs %}
233
-
{% highlight c# tabtitle="TypeScript" %}
234
-
235
-
import {PdfDocument, PdfPage, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
236
-
237
-
// Load an existing PDF document
238
-
let document: PdfDocument = new PdfDocument(data, password);
239
-
// Get the bookmarks
240
-
let bookmarks: PdfBookmarkBase = document.bookmarks;
241
-
// Remove all the bookmark from the collection.
242
-
bookmarks.clear();
243
-
// Get count after removal of all outlines.
244
-
let count: number = bookmarks.count;
245
-
// Save the document
246
-
document.save('Output.pdf');
247
-
// Destroy the document
248
-
document.destroy();
223
+
{% highlight javascript tabtitle="TypeScript" %}
224
+
import {PdfDocument, PdfPage, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
249
225
250
-
{% endhighlight %}
251
-
{% highlight c# tabtitle="JavaScript" %}
226
+
// Load an existing PDF document
227
+
let document: PdfDocument = new PdfDocument(data);
228
+
// Get the bookmarks
229
+
let bookmarks: PdfBookmarkBase = document.bookmarks;
230
+
// Remove all the bookmark from the collection.
231
+
bookmarks.clear();
232
+
// Get count after removal of all outlines.
233
+
let count: number = bookmarks.count;
234
+
// Save the document
235
+
document.save('Output.pdf');
236
+
// Destroy the document
237
+
document.destroy();
252
238
239
+
{% endhighlight %}
240
+
{% highlight javascript tabtitle="JavaScript" %}
253
241
// Load an existing PDF document
254
-
var document = new ej.pdf.PdfDocument(data, password);
242
+
var document = new ej.pdf.PdfDocument(data);
255
243
// Get the bookmarks
256
244
var bookmarks = document.bookmarks;
257
245
// Remove all the bookmarks from the collection
@@ -271,26 +259,24 @@ document.destroy();
271
259
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.
272
260
273
261
{% tabs %}
274
-
{% highlight c# tabtitle="TypeScript" %}
262
+
{% highlight javascript tabtitle="TypeScript" %}
263
+
import {PdfDocument, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
275
264
276
-
import {PdfDocument, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
277
-
278
-
// Load an existing PDF document
279
-
let document: PdfDocument = new PdfDocument(data, password);
280
-
// Get bookmarks
281
-
let bookmarks: PdfBookmarkBase = document.bookmarks;
282
-
// Get bookmark at the specified index
283
-
let pageIndex: number = bookmarks.destination.pageIndex;
284
-
// Save the document
285
-
document.save('Output.pdf');
286
-
// Close the document
287
-
document.destroy();
265
+
// Load an existing PDF document
266
+
let document: PdfDocument = new PdfDocument(data);
267
+
// Get bookmarks
268
+
let bookmarks: PdfBookmarkBase = document.bookmarks;
269
+
// Get bookmark at the specified index
270
+
let pageIndex: number = bookmarks.destination.pageIndex;
271
+
// Save the document
272
+
document.save('Output.pdf');
273
+
// Close the document
274
+
document.destroy();
288
275
289
276
{% endhighlight %}
290
-
{% highlight c# tabtitle="JavaScript" %}
291
-
277
+
{% highlight javascript tabtitle="JavaScript" %}
292
278
// Load an existing PDF document
293
-
var document = new ej.pdf.PdfDocument(data, password);
0 commit comments