Skip to content

Commit 2e08032

Browse files
1010299: changes commit
1 parent 3c1d611 commit 2e08032

4 files changed

Lines changed: 50 additions & 41 deletions

File tree

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ document.destroy();
929929

930930
## Sign existing signature field
931931

932-
This section explains how to apply a digital signature to an existing unsigned signature field in a PDF form. The JavaScript PDF library lets you locate predefined signature fields and sign them without modifying the document layout. This is especially useful for templates where signature placeholders already exist. By applying a certificate and signature settings, you can securely complete the signature field and follow standard PDF signing workflows.
932+
This section explains how to sign an existing unsigned signature field in a PDF using the JavaScript PDF library. You can locate predefined signature fields and apply a digital signature directly by calling `field.setSignature()`, without altering the document layout. This is ideal for templates where signature placeholders already exist, allowing you to securely complete the field using a certificate and signature settings.
933933

934934
{% tabs %}
935935
{% highlight typescript tabtitle="TypeScript" %}
@@ -948,9 +948,9 @@ const signature: PdfSignature = PdfSignature.create(certificate, 'password', {
948948
});
949949
// Apply the signature to the field
950950
field.setSignature(signature);
951-
// Add a form field
952-
document.form.add(field);
953-
// Destroy the document
951+
// Save the document
952+
document.save('Output.pdf');
953+
// Close the document
954954
document.destroy();
955955

956956
{% endhighlight %}
@@ -969,17 +969,17 @@ const signature = ej.pdf.PdfSignature.create(certificate, 'password', {
969969
});
970970
// Apply the signature to the field
971971
field.setSignature(signature);
972-
// Add a form field
973-
document.form.add(field);
974-
// Destroy the document
972+
// Save the document
973+
document.save('Output.pdf');
974+
// Close the document
975975
document.destroy();
976976

977977
{% endhighlight %}
978978
{% endtabs %}
979979

980980
## Remove existing digital signature
981981

982-
This section explains how to remove one or more digital signatures from a PDF and restore the document to an signed or unsigned state. The JavaScript PDF library allows you to clear signature dictionaries so the file can be edited, re‑signed, or corrected. Removing a signature also invalidates any associated certification, making the document fully editable again. This is useful when preparing a PDF for updates or resolving signature‑related issues.
982+
This section explains how to remove an existing digital signature from a PDF by using `removeField()` to delete the signature field entirely. Removing the field clears the signature dictionary, allowing the document to be edited, corrected, or re‑signed as needed. This is useful when preparing a PDF for updates or resolving signature‑related issues.
983983

984984
{% tabs %}
985985
{% highlight typescript tabtitle="TypeScript" %}
@@ -990,9 +990,9 @@ let document: PdfDocument = new PdfDocument(data);
990990
// Access loaded form
991991
let form: PdfForm = document.form;
992992
// Access the loaded form field
993-
let field: PdfSignatureField = form.fieldAt(0) as PdfSignatureField;
993+
let field: PdfSignatureField = form.fieldAt(0);
994994
// Remove the form field
995-
if (field instanceof PdfSignatureField ) {
995+
if (field instanceof PdfSignatureField) {
996996
document.form.removeField(field);
997997
}
998998
// Destroy the document

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -853,11 +853,11 @@ document. Destroy();
853853

854854
## Add a date field to a PDF form
855855

856-
This section shows how to add a date field to a PDF form, allowing users to enter or select a date within the document. The JavaScript PDF library lets you configure the date field’s appearance, format, and behavior. You can also use `dateField.actions` to trigger custom scripts or validations when the field is focused, changed, or submitted.
856+
This section shows how to add a date field to a PDF form, allowing users to enter or select a date within the document. The JavaScript PDF library lets you configure the date field’s appearance, format, and behavior. You can use `dateField.actions` to trigger custom scripts or validations when the field is focused, changed, or submitted.
857857

858858
{% tabs %}
859859
{% highlight typescript tabtitle="TypeScript" %}
860-
import {PdfDocument, pdfPage, PdfForm, PdfTextBoxField, PdfJavaScriptAction, PdfFormFieldsTabOrder } from '@syncfusion/ej2-pdf';
860+
import {PdfDocument, pdfPage, PdfForm, PdfTextBoxField, PdfJavaScriptAction } from '@syncfusion/ej2-pdf';
861861

862862
// Create a new PDF document
863863
let document: PdfDocument = new PdfDocument();
@@ -895,7 +895,7 @@ var page = document.addPage();
895895
var form = document.form;
896896
// Create a new text box field
897897
const field = new ej.pdf.PdfTextBoxField(page, 'fieldF', {
898-
x: 50, y: 200, width: 150, height: 20,
898+
x: 50, y: 200, width: 150, height: 20
899899
});
900900
// Sets the text value to text box field
901901
field.text = '18/08/2003';

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This example demonstrates how to create an ordered list in a PDF document using
1616

1717
{% tabs %}
1818
{% highlight typescript tabtitle="TypeScript" %}
19-
import { PdfDocument, PdfPage, PdfListItemCollection, PdfBrush, PdfStringFormat, PdfPen, PdfNumberStyle, PdfOrderedList, PdfListItemCollection } from '@syncfusion/ej2-pdf';
19+
import { PdfDocument, PdfPage, PdfListItemCollection, PdfBrush, PdfStringFormat, PdfPen, PdfNumberStyle, PdfOrderedList, PdfListItemCollection, PdfFontFamily, PdfFontStyle, PdfTextAlignment } from '@syncfusion/ej2-pdf';
2020

2121
// Load an existing document
2222
let document: PdfDocument = new PdfDocument(data);
@@ -80,7 +80,7 @@ This example demonstrates how to create an unordered list in a PDF document usin
8080

8181
{% tabs %}
8282
{% highlight typescript tabtitle="TypeScript" %}
83-
import { PdfDocument, PdfPage, PdfList, PdfStandardFont, PdfBrush, PdfStringFormat, PdfPen, PdfNumberStyle, PdfUnorderedListStyle, PdfListItemCollection } from '@syncfusion/ej2-pdf';
83+
import { PdfDocument, PdfPage, PdfBrush, PdfStringFormat, PdfFontFamily, PdfUnorderedList, PdfFontStyle, PdfPen, PdfUnorderedListStyle, PdfListItemCollection } from '@syncfusion/ej2-pdf';
8484

8585
// Load the existing document
8686
let document: PdfDocument = new PdfDocument(data);
@@ -98,7 +98,7 @@ let list: PdfUnorderedList = new PdfUnorderedList(items, {
9898
brush: new PdfBrush({ r: 0, g: 255, b: 255 }),
9999
indent: 30,
100100
textIndent: 50,
101-
style: PdfNumberStyle.numeric,
101+
style: PdfUnorderedListStyle.disk,
102102
delimiter: ')'
103103
});
104104
// Draw the unordered list on the page
@@ -125,7 +125,7 @@ var list = new ej.pdf.PdfUnorderedList(items, {
125125
brush: new ej.pdf.PdfBrush({ r: 0, g: 255, b: 255 }),
126126
indent: 30,
127127
textIndent: 50,
128-
style: ej.pdf.PdfNumberStyle.numeric,
128+
style: ej.pdf.PdfUnorderedListStyle.disk,
129129
delimiter: ')'
130130
});
131131
// Draw the unordered list on the page
@@ -145,6 +145,7 @@ This example demonstrates how to customize the marker style of an unordered list
145145
{% tabs %}
146146
{% highlight typescript tabtitle="TypeScript" %}
147147
import { PdfDocument, PdfPage, PdfUnorderedList, PdfUnorderedListStyle, PdfListItemCollection } from '@syncfusion/ej2-pdf';
148+
148149
// Load the existing document
149150
let document: PdfDocument = new PdfDocument(data);
150151
// Access the first page
@@ -189,13 +190,14 @@ document.destroy();
189190
{% endhighlight %}
190191
{% endtabs %}
191192

192-
## Customizing list fonts
193+
## Applying custom fonts to list items
193194

194-
This example demonstrates how to customize the font used for list items in a PDF document using the `PdfUnorderedList` class. The list supports multiple font types, allowing you to tailor the appearance to different languages and stylistic requirements. You can apply standard PDF fonts, TrueType fonts, or CJK fonts to ensure proper rendering of Western, Unicode, and East Asian text. By selecting an appropriate font family and size, you can create lists that match your document design and provide better readability across various languages.
195+
This example shows how to apply custom fonts to list items in a PDF by using embedded fonts through `document.embedFont()`. The list supports Standard, TrueType, and CJK fonts, allowing accurate rendering of multilingual text. By selecting an embedded font and applying it to the list, you can control the style and appearance of list content with better consistency across platforms.
195196

196197
{% tabs %}
197198
{% highlight typescript tabtitle="TypeScript" %}
198-
import { PdfDocument, PdfPage, PdfUnorderedList, PdfListItemCollection } from '@syncfusion/ej2-pdf';
199+
import { PdfDocument, PdfPage, PdfUnorderedList, PdfListItemCollection, PdfFontFamily, PdfFontStyle } from '@syncfusion/ej2-pdf';
200+
199201
// Load the existing document
200202
let document: PdfDocument = new PdfDocument(data);
201203
// Access the first page
@@ -242,11 +244,12 @@ document.destroy();
242244

243245
## Creating nested list structures
244246

245-
This example demonstrates how to create nested list structures in a PDF document using the `PdfUnorderedList` and `PdfOrderedList` classes. Nested lists allow you to organize information hierarchically by placing one list inside another. This is useful when representing multi‑level data, outlining topics with subpoints, or grouping related items clearly. Each nested level can have its own marker style, font settings, and giving you full control over the appearance and structure of complex list content.
247+
This example demonstrates how to create nested list structures in a PDF document using the `PdfUnorderedList` and `PdfOrderedList` classes. Nested lists allow you to organize information hierarchically by placing one list inside another. This is useful when representing multi‑level data, outlining topics with subpoints, or grouping related items clearly.
246248

247249
{% tabs %}
248250
{% highlight typescript tabtitle="TypeScript" %}
249251
import { PdfDocument, PdfPage, PdfOrderedList, PdfUnorderedList, PdfUnorderedListStyle, PdfListItemCollection } from '@syncfusion/ej2-pdf';
252+
250253
// Load the existing document
251254
let document: PdfDocument = new PdfDocument(data);
252255
// Access the first page
@@ -283,16 +286,18 @@ list.draw(page, {x: 50, y: 150});
283286
document.save('output.pdf');
284287
// Destroy the document
285288
document.destroy();
289+
286290
{% endhighlight %}
287291
{% endtabs %}
288292

289293
## list pagination
290294

291-
This example demonstrates how the `PdfUnorderedList` class automatically handle pagination when drawing long lists in a PDF document. List pagination ensures that long lists automatically continue onto the next page when there is no remaining space on the current one. The list layout engine preserves marker styles, indentation, and nested levels across page breaks. This provides a smooth and consistent reading experience, even for multi‑page or dynamically generated list content.
295+
This example shows how long lists automatically continue onto the next page when drawn using the `PdfUnorderedList` class. By applying a `PdfLayoutFormat`, the layout engine handles page breaks smoothly while preserving markers, indentation, and nested levels. This ensures consistent rendering of multi‑page or dynamically generated list content.
292296

293297
{% tabs %}
294298
{% highlight typescript tabtitle="TypeScript" %}
295299
import { PdfDocument, PdfPage, PdfList, PdfLayoutFormat, PdfUnorderedList, PdfLayoutBreakType, PdfLayoutType, PdfListItemCollection } from '@syncfusion/ej2-pdf';
300+
296301
// Load the existing document
297302
let document: PdfDocument = new PdfDocument(data);
298303
// Access the first page

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

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,14 @@ document.destroy();
357357
{% endhighlight %}
358358
{% endtabs %}
359359

360-
## Draw RTL text using TrueType fonts
360+
## Drawing Right-To-Left text
361361

362362
This example shows how to draw right-to-left (RTL) text using a TrueType font that supports the target RTL script (for example, Hebrew or Arabic). Embed a TTF font that contains the needed glyphs and pass a `PdfStringFormat` when calling `drawString`.
363363

364364
{% tabs %}
365365
{% highlight typescript tabtitle="TypeScript" %}
366366
import { PdfDocument, PdfPage, PdfTrueTypeFont, PdfStringFormat, PdfBrush } from '@syncfusion/ej2-pdf';
367+
367368
// Create a new PDF document
368369
let document: PdfDocument = new PdfDocument();
369370
// Add a page
@@ -373,7 +374,7 @@ let font: PdfTrueTypeFont = document.embedFont(data, 13);
373374
// Draw text
374375
page.graphics.drawString(`שלום עולם!!!`, font, { x: 0, y: 200, width: 100, height: 100 }, new PdfBrush({ r: 0, g: 0, b: 0 }), new PdfStringFormat());
375376
// Save the document
376-
document.save('RTL_Text.pdf');
377+
document.save('Output.pdf');
377378
// Close the document
378379
document.destroy();
379380

@@ -389,34 +390,36 @@ var font = document.embedFont(data, 13);
389390
// Draw text
390391
page.graphics.drawString(`שלום עולם!!!`, font, { x: 0, y: 200, width: 100, height: 100 }, new ej.pdf.PdfBrush({ r: 0, g: 0, b: 0 }), new ej.pdf.PdfStringFormat());
391392
// Save the document
392-
document.save('RTL_Text.pdf');
393+
document.save('Output.pdf');
393394
// Close the document
394395
document.destroy();
396+
395397
{% endhighlight %}
396398
{% endtabs %}
397399

398400
## Embedded font
399401

400-
This example demonstrates how to embed fonts in a PDF document to ensure accurate and consistent text rendering across all platforms. The library supports embedding PdfStandardFont, PdfCjkStandardFont, and PdfTrueTypeFont, enabling reliable display of Western, CJK, and Unicode text even when the required fonts are not installed on the viewing device. Embedded fonts also provide easy access to different font sizes, and styles, allowing you to format text precisely while maintaining the document’s visual consistency.
402+
This example shows how to embed fonts using `document.embedFont()` to ensure consistent text rendering across all platforms. The library supports embedding `PdfStandardFont`, `PdfCjkStandardFont`, and `PdfTrueTypeFont` for reliable Western, CJK, and Unicode text display. After embedding, the font can be applied through `embedded.getFont()`, allowing precise control over size and style.
401403

402404
{% tabs %}
403405
{% highlight typescript tabtitle="TypeScript" %}
404-
import { PdfDocument, PdfPage, PdfFont, PdfFontFamily, PdfFontStyle, PdfCjkFontFamily, PdfBrush } from '@syncfusion/ej2-pdf';
406+
import { PdfDocument, PdfPage, PdfFont, PdfStandardFont, PdfCjkStandardFont, PdfFontFamily, PdfFontStyle, PdfCjkFontFamily, PdfBrush } from '@syncfusion/ej2-pdf';
405407

406408
// Create a new PDF document
407409
let document: PdfDocument = new PdfDocument();
408410
// Add a page
409411
let page: PdfPage = document.addPage();
410412
// Embed a font into the PDF document.
411-
const embedded: PdfFont = document.embedFont(PdfFontFamily.timesRoman, 12, PdfFontStyle.regular);
412-
const embedded1: PdfFont = embedded.getFont(14, PdfFontStyle.bold);
413-
const embedded2: PdfFont = document.embedFont(PdfCjkFontFamily.hanyangSystemsGothicMedium, 12, PdfFontStyle.regular , true);
414-
const embedded3: PdfFont = embedded3.getFont(14, PdfFontStyle.bold);
413+
const embedded1: PdfStandardFont = document.embedFont(PdfFontFamily.timesRoman, 12, PdfFontStyle.regular);
414+
const embedded2: PdfCjkStandardFont = document.embedFont(PdfCjkFontFamily.hanyangSystemsGothicMedium, 12, PdfFontStyle.regular , true);
415+
// Gets a font variant from the base font with the given size and style
416+
const embedded3: PdfFont = embedded1.getFont(14, PdfFontStyle.bold);
417+
const embedded4: PdfFont = embedded2.getFont(14, PdfFontStyle.bold);
415418
// Draw string using embed font.
416-
page.graphics.drawString('timesRoman with regular', embedded, {x: 10, y: 10, width: 300, height: 24}, new PdfBrush({r: 0, g: 0, b: 255}));
417-
page.graphics.drawString('timesRoman with bold', embedded1, {x: 10, y: 50, width: 300, height: 24}, new PdfBrush({r: 0, g: 0, b: 255}));
419+
page.graphics.drawString('timesRoman with regular', embedded1, {x: 10, y: 10, width: 300, height: 24}, new PdfBrush({r: 0, g: 0, b: 255}));
420+
page.graphics.drawString('timesRoman with bold', embedded3, {x: 10, y: 50, width: 300, height: 24}, new PdfBrush({r: 0, g: 0, b: 255}));
418421
page.graphics.drawString('Cjkfont with regular', embedded2, {x: 200, y: 10, width: 300, height: 24}, new PdfBrush({r: 0, g: 0, b: 255}));
419-
page.graphics.drawString('Cjkfont with bold', embedded3, {x: 200, y: 50, width: 300, height: 24}, new PdfBrush({r: 0, g: 0, b: 255}));
422+
page.graphics.drawString('Cjkfont with bold', embedded4, {x: 200, y: 50, width: 300, height: 24}, new PdfBrush({r: 0, g: 0, b: 255}));
420423
// Save the document
421424
document.save('Output.pdf');
422425
// Close the document
@@ -430,15 +433,16 @@ var document = new new ej.pdf.PdfDocument();
430433
// Add a page
431434
var page = document.addPage();
432435
// Embed a font into the PDF document.
433-
const embedded = document.embedFont(new ej.pdf.PdfFontFamily.timesRoman, 12, new ej.pdf.PdfFontStyle.regular);
434-
const embedded1 = embedded.getFont(14, new ej.pdf.PdfFontStyle.bold);
436+
const embedded1 = document.embedFont(new ej.pdf.PdfFontFamily.timesRoman, 12, new ej.pdf.PdfFontStyle.regular);
435437
const embedded2 = document.embedFont(new ej.pdf.PdfCjkFontFamily.hanyangSystemsGothicMedium, 12, new ej.pdf.PdfFontStyle.regular , true);
436-
const embedded3 = embedded3.getFont(14, new ej.pdf.PdfFontStyle.bold);
438+
// Gets a font variant from the base font with the given size and style
439+
const embedded3 = embedded1.getFont(14, new ej.pdf.PdfFontStyle.bold);
440+
const embedded4 = embedded4.getFont(14, new ej.pdf.PdfFontStyle.bold);
437441
// Draw string using embed font.
438-
page.graphics.drawString('timesRoman with regular', embedded, {x: 10, y: 10, width: 300, height: 24}, new new ej.pdf.PdfBrush({r: 0, g: 0, b: 255}));
439-
page.graphics.drawString('timesRoman with bold', embedded1, {x: 10, y: 50, width: 300, height: 24}, new new ej.pdf.PdfBrush({r: 0, g: 0, b: 255}));
440-
page.graphics.drawString('Cjkfont with regular', embedded2, {x: 200, y: 10, width: 300, height: 24}, new new ej.pdf.PdfBrush({r: 0, g: 0, b: 255}));
441-
page.graphics.drawString('Cjkfont with bold', embedded3, {x: 200, y: 50, width: 300, height: 24}, new new ej.pdf.PdfBrush({r: 0, g: 0, b: 255}));
442+
page.graphics.drawString('timesRoman with regular', embedded1, {x: 10, y: 10, width: 300, height: 24}, new ej.pdf.PdfBrush({r: 0, g: 0, b: 255}));
443+
page.graphics.drawString('timesRoman with bold', embedded3, {x: 10, y: 50, width: 300, height: 24}, new ej.pdf.PdfBrush({r: 0, g: 0, b: 255}));
444+
page.graphics.drawString('Cjkfont with regular', embedded2, {x: 200, y: 10, width: 300, height: 24}, new ej.pdf.PdfBrush({r: 0, g: 0, b: 255}));
445+
page.graphics.drawString('Cjkfont with bold', embedded4, {x: 200, y: 50, width: 300, height: 24}, new ej.pdf.PdfBrush({r: 0, g: 0, b: 255}));
442446
// Save the document
443447
document.save('Output.pdf');
444448
// Close the document

0 commit comments

Comments
 (0)