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/DigitalSignature.md
+130Lines changed: 130 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -884,5 +884,135 @@ var signedDocumentData = ej.pdf.PdfSignature.replaceEmptySignature(
884
884
// Destroy the document
885
885
document.destroy();
886
886
887
+
{% endhighlight %}
888
+
{% endtabs %}
889
+
890
+
## Document revisions
891
+
892
+
Digital signatures create incremental revisions in a PDF, preserving each version of the document as new signatures are added. These revisions allow you to view the state of the document at the time of signing and verify whether any changes occurred afterward. The API provides access to these versions through `getRevisions()` for all revisions and `getRevision()` for the specific revision tied to a signature.
893
+
894
+
{% tabs %}
895
+
{% highlight typescript tabtitle="TypeScript" %}
896
+
import {PdfDocument, PdfForm, PdfSignatureField} from '@syncfusion/ej2-pdf';
897
+
898
+
// Load an existing PDF document
899
+
let document: PdfDocument = new PdfDocument(data);
900
+
// Access loaded form
901
+
let form: PdfForm = document.form;
902
+
// Access the loaded form field
903
+
let signature: PdfSignatureField = form.fieldAt(0);
904
+
// Retrieve all revision indexes of the PDF document
905
+
let revisions: number[] = document.getRevisions();
906
+
// Gets the revision number associated with the signature field
907
+
let revision: number = signature.getRevision();
908
+
// Destroy the document
909
+
document.destroy();
910
+
911
+
{% endhighlight %}
912
+
{% highlight javascript tabtitle="JavaScript" %}
913
+
914
+
// Load an existing PDF document
915
+
var document = new ej.pdf.PdfDocument(data);
916
+
// Access loaded form
917
+
var form = document.form;
918
+
// Access the loaded form field
919
+
var signature = form.fieldAt(0);
920
+
// Retrieve all revision indexes of the PDF document
921
+
var revisions = document.getRevisions();
922
+
// Gets the revision number associated with the signature field
923
+
var revision = signature.getRevision();
924
+
// Destroy the document
925
+
document.destroy();
926
+
927
+
{% endhighlight %}
928
+
{% endtabs %}
929
+
930
+
## Sign existing signature field
931
+
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.
933
+
934
+
{% tabs %}
935
+
{% highlight typescript tabtitle="TypeScript" %}
936
+
import {PdfDocument, PdfForm, DigestAlgorithm, CryptographicStandard, PdfSignatureField} from '@syncfusion/ej2-pdf';
937
+
938
+
// Load an existing PDF document
939
+
let document: PdfDocument = new PdfDocument(data);
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.
983
+
984
+
{% tabs %}
985
+
{% highlight typescript tabtitle="TypeScript" %}
986
+
import {PdfDocument, PdfForm, PdfSignatureField} from '@syncfusion/ej2-pdf';
987
+
988
+
// Load an existing PDF document
989
+
let document: PdfDocument = new PdfDocument(data);
990
+
// Access loaded form
991
+
let form: PdfForm = document.form;
992
+
// Access the loaded form field
993
+
let field: PdfSignatureField = form.fieldAt(0) as PdfSignatureField;
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Library/javascript/FormFields.md
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -851,6 +851,70 @@ document. Destroy();
851
851
{% endhighlight %}
852
852
{% endtabs %}
853
853
854
+
## Add a date field to a PDF form
855
+
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.
857
+
858
+
{% tabs %}
859
+
{% highlight typescript tabtitle="TypeScript" %}
860
+
import {PdfDocument, pdfPage, PdfForm, PdfTextBoxField, PdfJavaScriptAction, PdfFormFieldsTabOrder } from '@syncfusion/ej2-pdf';
861
+
862
+
// Create a new PDF document
863
+
let document: PdfDocument = new PdfDocument();
864
+
// Add a new page to the document
865
+
let page: pdfPage = document.addPage();
866
+
// Access loaded form
867
+
let form: PdfForm = document.form;
868
+
// Create a new text box field
869
+
const field: PdfTextBoxField = new PdfTextBoxField(page, 'fieldF', {
870
+
x: 50, y: 200, width: 150, height: 20,
871
+
});
872
+
// Sets the text value to text box field
873
+
field.text = '18/08/2003';
874
+
// Sets date formate
875
+
const format: string = 'yyyy-mm-dd';
876
+
// Create a new `PdfJavaScriptAction` for adding the action
877
+
field.actions.format = new PdfJavaScriptAction(`AFDate_FormatEx("${format}");`);
878
+
field.actions.keyPressed = new PdfJavaScriptAction(`AFDate_KeystrokeEx("${format}"):`);
879
+
field.actions.validate = new PdfJavaScriptAction(`AFDate_Validate("${format}");`);
880
+
// Add a new form field
881
+
form.add(field);
882
+
// Save the document
883
+
document.save('output.pdf');
884
+
// Destroy the document
885
+
document. Destroy();
886
+
887
+
{% endhighlight %}
888
+
{% highlight javascript tabtitle="JavaScript" %}
889
+
890
+
// Create a new PDF document instance
891
+
var document = new ej.pdf.PdfDocument();
892
+
// Add a new page to the document
893
+
var page = document.addPage();
894
+
// Access loaded form
895
+
var form = document.form;
896
+
// Create a new text box field
897
+
const field = new ej.pdf.PdfTextBoxField(page, 'fieldF', {
898
+
x: 50, y: 200, width: 150, height: 20,
899
+
});
900
+
// Sets the text value to text box field
901
+
field.text = '18/08/2003';
902
+
// Sets date formate
903
+
const format = 'yyyy-mm-dd';
904
+
// Create a new `PdfJavaScriptAction` for adding the action
905
+
field.actions.format = new ej.pdf.PdfJavaScriptAction(`AFDate_FormatEx("${format}");`);
906
+
field.actions.keyPressed = new ej.pdf.PdfJavaScriptAction(`AFDate_KeystrokeEx("${format}"):`);
907
+
field.actions.validate = new ej.pdf.PdfJavaScriptAction(`AFDate_Validate("${format}");`);
908
+
// Add a new form field
909
+
form.add(field);
910
+
// Save the document
911
+
document.save('Output.pdf');
912
+
// Destroy the document
913
+
document. Destroy();
914
+
915
+
{% endhighlight %}
916
+
{% endtabs %}
917
+
854
918
## Field Auto Naming
855
919
856
920
To prevent grouping when adding fields with the same name, you can enable the `fieldAutoNaming` property of `PdfForm` class. Setting fieldAutoNaming to true ensures that each field gets a unique name internally, even if you specify the same name during creation.
0 commit comments