Skip to content

Commit 86183c7

Browse files
Merge pull request #1937 from syncfusion-content/998417
998417: Added proper feedback changes based on loop page.
2 parents 3f889d8 + 8ab6645 commit 86183c7

26 files changed

+2414
-3205
lines changed

Document-Processing/PDF/PDF-Library/javascript/Annotations.md

Lines changed: 552 additions & 659 deletions
Large diffs are not rendered by default.

Document-Processing/PDF/PDF-Library/javascript/Bookmarks.md

Lines changed: 121 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,26 @@ Syncfusion<sup>&reg;</sup> PDF provides support to insert, remove and modify the
1414
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.
1515

1616
{% 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';
3519

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();
3834

35+
{% endhighlight %}
36+
{% highlight javascript tabtitle="JavaScript" %}
3937
// Create a new PDF document
4038
var document = new ej.pdf.PdfDocument();
4139
// Add page
@@ -59,30 +57,28 @@ document.destroy();
5957
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.
6058

6159
{% 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();
8077

8178
{% endhighlight %}
82-
{% highlight c# tabtitle="JavaScript" %}
83-
79+
{% highlight javascript tabtitle="JavaScript" %}
8480
// Load an existing PDF document
85-
var document = new ej.pdf.PdfDocument(data, password);
81+
var document = new ej.pdf.PdfDocument(data);
8682
// Get page
8783
var page = document.getPage(0);
8884
// Get the bookmarks
@@ -104,30 +100,28 @@ document.destroy();
104100
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.
105101

106102
{% 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';
125105

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();
128120

121+
{% endhighlight %}
122+
{% highlight javascript tabtitle="JavaScript" %}
129123
// Load an existing PDF document
130-
var document = new ej.pdf.PdfDocument(data, password);
124+
var document = new ej.pdf.PdfDocument(data);
131125
// Get the first page
132126
var page = document.getPage(0);
133127
// Get the bookmarks
@@ -148,28 +142,26 @@ document.destroy();
148142

149143
This example demonstrates how to remove bookmarks from an existing PDF document using the `PdfBookmark` class.
150144
{% 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';
167147

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();
170160

161+
{% endhighlight %}
162+
{% highlight javascript tabtitle="JavaScript" %}
171163
// Load an existing PDF document
172-
var document = new ej.pdf.PdfDocument(data, password);
164+
var document = new ej.pdf.PdfDocument(data);
173165
// Get the first page
174166
var page = document.getPage(0);
175167
// Get the bookmarks
@@ -189,28 +181,26 @@ document.destroy();
189181
This example demonstrates how to remove bookmarks from the document at the specific index using the `PdfBookmark` class.
190182

191183
{% 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';
208186

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();
211199

200+
{% endhighlight %}
201+
{% highlight javascript tabtitle="JavaScript" %}
212202
// Load an existing PDF document
213-
var document = new ej.pdf.PdfDocument(data, password);
203+
var document = new ej.pdf.PdfDocument(data);
214204
// Get the first page
215205
var page = document.getPage(0);
216206
// Get the bookmarks
@@ -230,28 +220,26 @@ document.destroy();
230220
This example demonstrates how to removes all the bookmarks from the collection using the `PdfBookmark` class.
231221

232222
{% 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';
249225

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();
252238

239+
{% endhighlight %}
240+
{% highlight javascript tabtitle="JavaScript" %}
253241
// Load an existing PDF document
254-
var document = new ej.pdf.PdfDocument(data, password);
242+
var document = new ej.pdf.PdfDocument(data);
255243
// Get the bookmarks
256244
var bookmarks = document.bookmarks;
257245
// Remove all the bookmarks from the collection
@@ -271,26 +259,24 @@ document.destroy();
271259
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.
272260

273261
{% tabs %}
274-
{% highlight c# tabtitle="TypeScript" %}
262+
{% highlight javascript tabtitle="TypeScript" %}
263+
import {PdfDocument, PdfBookmarkBase} from '@syncfusion/ej2-pdf';
275264

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();
288275

289276
{% endhighlight %}
290-
{% highlight c# tabtitle="JavaScript" %}
291-
277+
{% highlight javascript tabtitle="JavaScript" %}
292278
// Load an existing PDF document
293-
var document = new ej.pdf.PdfDocument(data, password);
279+
var document = new ej.pdf.PdfDocument(data);
294280
// Get bookmarks
295281
var bookmarks = document.bookmarks;
296282
// Get the first bookmark (or any specific one)

0 commit comments

Comments
 (0)