Skip to content

Commit 1f66cb2

Browse files
Merge branch 'development' into 1012753-Add-working-with-ink-page_docio
2 parents 7c32777 + 6d1b999 commit 1f66cb2

7 files changed

Lines changed: 448 additions & 0 deletions

File tree

Document-Processing-toc.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,14 @@
11631163
<li><a href="/document-processing/pdf/pdf-viewer/react/forms/submit-form-data">Submit form data</a></li>
11641164
</ul>
11651165
</li>
1166+
<li>Digital Signature
1167+
<ul>
1168+
<li><a href="/document-processing/pdf/pdf-viewer/react/digital-signature/add-digital-signature-react">Add Digital Signature</a></li>
1169+
<li><a href="/document-processing/pdf/pdf-viewer/react/digital-signature/customize-signature-appearance">Customize Signature Appearance</a></li>
1170+
<li><a href="/document-processing/pdf/pdf-viewer/react/digital-signature/validate-digital-signatures">Validate Digital Signature</a></li>
1171+
<li><a href="/document-processing/pdf/pdf-viewer/react/digital-signature/signature-workflow">Signature Workflow</a></li>
1172+
</ul>
1173+
</li>
11661174
<li><a href="/document-processing/pdf/pdf-viewer/react/organize-pages/overview">Organize Pages</a>
11671175
<ul>
11681176
<li><a href="/document-processing/pdf/pdf-viewer/react/organize-pages/copy-pages">Copy pages</a></li>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
layout: post
3+
title: Add Digital Signature to PDF in React PDF Viewer | Syncfusion
4+
description: Learn how to add signature fields and apply PKI-based digital signatures using Syncfusion React PDF Viewer and JavaScript PDF Library.
5+
platform: document-processing
6+
control: PdfViewer
7+
documentation: ug
8+
---
9+
10+
# Add Digital Signature to PDF
11+
12+
This section explains how to **add signature fields** using the Syncfusion **React PDF Viewer** and how to apply **digital (PKI) signatures** using the **JavaScript PDF Library**.
13+
14+
N> As instructed by team leads — use the **React PDF Viewer only to add & place signature fields**. Use the **JavaScript PDF Library** to apply the *actual cryptographic digital signature*.
15+
16+
## Overview (Explanation)
17+
18+
A **digital signature** provides:
19+
- **Authenticity** – confirms the signer’s identity.
20+
- **Integrity** – detects modification after signing.
21+
- **Non‑repudiation** – signer cannot deny signing.
22+
23+
Syncfusion supports a hybrid workflow:
24+
- Viewer → **[Design signature fields](../forms/manage-form-fields/create-form-fields#signature-field)**, capture Draw/Type/Upload electronic signature.
25+
- PDF Library → **[Apply PKCS#7/CMS digital signature](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature)** using a certificate (PFX/P12).
26+
27+
## Add a Signature Field (How-to)
28+
29+
### Using the UI
30+
1. Open **Form Designer**.
31+
2. Select **Signature Field**.
32+
3. Click on the document to place the field.
33+
4. Configure Name, Tooltip, Required, etc.
34+
35+
![Signature annotation toolbar](../../javascript-es6/images/add_sign.png)
36+
37+
### Using the API
38+
{% tabs %}
39+
{% highlight js tabtitle="Standalone" %}
40+
{% raw %}
41+
viewerRef.current?.formDesignerModule.addFormField('SignatureField', {
42+
name: 'ApproverSignature',
43+
pageNumber: 1,
44+
bounds: { X: 72, Y: 640, Width: 220, Height: 48 },
45+
isRequired: true,
46+
tooltip: 'Sign here'
47+
});
48+
{% endraw %}
49+
{% endhighlight %}
50+
{% endtabs %}
51+
52+
## Capture Electronic Signature (Draw / Type / Upload)
53+
Users click the field → dialog appears → they can **Draw**, **Type**, or **Upload** a handwritten signature.
54+
55+
This creates a *visual* signature only (not cryptographically secure).
56+
57+
## Apply PKI Digital Signature (JavaScript PDF Library)
58+
59+
Digital signature must be applied using **@syncfusion/ej2-pdf**.
60+
61+
```ts
62+
import { PdfDocument, PdfSignature, PdfSignatureField, CryptographicStandard, DigestAlgorithm } from '@syncfusion/ej2-pdf';
63+
64+
const document = new PdfDocument(pdfBytes);
65+
const page = document.getPage(0);
66+
67+
let field = new PdfSignatureField(page, 'ApproverSignature', {
68+
x: 72,
69+
y: 640,
70+
width: 220,
71+
height: 48
72+
});
73+
document.form.add(field);
74+
75+
const signature = PdfSignature.create(
76+
{
77+
cryptographicStandard: CryptographicStandard.cms,
78+
digestAlgorithm: DigestAlgorithm.sha256
79+
},
80+
pfxBytes,
81+
password
82+
);
83+
84+
field.setSignature(signature);
85+
const signedBytes = await document.save();
86+
document.destroy();
87+
```
88+
89+
N> See the PDF Library [Digital signature](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature) to know more about Digital Signature in PDF Documents.
90+
91+
## Important Notes
92+
- **Do all form edits first. Sign last.** Any PDF modification *after signing* invalidates the signature.
93+
- Self‑signed PFX will show **Unknown / Untrusted** until added to Trusted Certificates.
94+
95+
## Best Practices
96+
- Place signature fields via Viewer for accurate layout.
97+
- Apply PKI signature using PDF Library only.
98+
- Use CMS + SHA‑256 for compatibility.
99+
- Avoid flattening after signing.
100+
101+
## See Also
102+
- [Validate Digital Signatures](./validate-digital-signatures)
103+
- [Custom fonts for Signature fields](../../how-to/custom-font-signature-field)
104+
- [Signature workflows](./signature-workflow)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
layout: post
3+
title: Customize Signature Appearance in React PDF Viewer | Syncfusion
4+
description: Learn here all about how to customize visible PKI digital signature appearances using the Syncfusion PDF Library.
5+
platform: document-processing
6+
control: PdfViewer
7+
documentation: ug
8+
---
9+
10+
# Customize Signature Appearance
11+
12+
This page explains how to customize the visual appearance of PKI [digital signature](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature) (visible signature appearance) produced with the Syncfusion PDF Library.
13+
14+
## Overview
15+
16+
When applying a PKI [digital signature](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature) you can create a visible appearance that includes text, images (logo/seal), fonts, and layout. Appearance rendering is done by composing signature appearance graphics with the PDF Library and embedding that appearance into the signature field.
17+
18+
For implementation details and exact API usage, check the Syncfusion PDF Library references:
19+
20+
- .NET PDF Library — [Drawing text/image in the signature appearance]( https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-digitalsignature#drawing-textimage-in-the-signature-appearance)
21+
- JavaScript PDF Library — [Drawing text/image in the signature appearance](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature#drawing-textimage-in-the-signature-appearance)
22+
23+
## What you can customize
24+
25+
- Text (signer name, signing reason, date, descriptive labels)
26+
- Fonts, sizes, and styles
27+
- Images (company logo, seal, signature image)
28+
- Layout and bounding box for the visible appearance
29+
- Visible vs invisible signatures
30+
31+
## Guidance
32+
33+
- Use the [PDF Library](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature) APIs to draw strings and images into the signature appearance graphics; attach the resulting appearance to the signature field before finalizing the PKI signature.
34+
- Prefer embedding high‑quality logo/seal images and use readable fonts for accessibility.
35+
- Keep the appearance compact to avoid overlapping form content and to preserve signature validation data.
36+
- Test appearances across typical page sizes and DPI settings to ensure consistent rendering.
37+
38+
## Best Practices
39+
40+
- Use consistent branding for signature visuals.
41+
- Keep appearance elements minimal and readable.
42+
- Avoid including data that might change after signing (dates shown should reflect signing time provided by the TSA when used).
43+
- When producing legally binding signatures, ensure the PKI signing process and appearance comply with your legal/operational requirements.
44+
45+
## See Also
46+
47+
- [Add Digital Signature](./add-digital-signature-react)
48+
- [Validate Digital Signatures](./validate-digital-signatures)
49+
- [Custom fonts for Signature fields](../../how-to/custom-font-signature-field)
50+
- [Signature workflows](./signature-workflow)
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
---
2+
layout: post
3+
title: Digital Signature Workflows in React PDF Viewer | Syncfusion
4+
description: Learn how to add signature fields and apply digital (PKI) signatures in the Syncfusion React PDF Viewer.
5+
platform: document-processing
6+
control: PdfViewer
7+
documentation: ug
8+
---
9+
10+
# Digital Signature Workflows
11+
12+
This guide shows how to design signature fields, collect handwritten/typed e‑signatures in the browser, and apply **digital certificate (PKI) signatures** to PDF forms using the Syncfusion React PDF Viewer and the JavaScript PDF Library. Digital signatures provide **authenticity** and **tamper detection**, making them suitable for legally binding scenarios.
13+
14+
## Overview
15+
16+
A **digital signature** is a cryptographic proof attached to a PDF that verifies the signer’s identity and flags any post‑sign changes. It differs from a simple electronic signature (handwritten image/typed name) by providing **tamper‑evidence** and compliance with standards like CMS/PKCS#7. The Syncfusion **JavaScript PDF Library** exposes APIs to create and validate digital signatures programmatically, while the **React PDF Viewer** lets you design signature fields and capture handwritten/typed signatures in the browser.
17+
18+
## Quick Start
19+
20+
Follow these steps to add a **visible digital signature** to an existing PDF and finalize it.
21+
22+
1. **Render the React PDF Viewer with form services**
23+
24+
{% tabs %}
25+
{% highlight js tabtitle="Standalone" %}
26+
{% raw %}
27+
import * as ReactDOM from 'react-dom/client';
28+
import * as React from 'react';
29+
import {
30+
PdfViewerComponent, Inject, Toolbar, Magnification, Navigation,
31+
LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch,
32+
Annotation, FormFields, FormDesigner
33+
} from '@syncfusion/ej2-react-pdfviewer';
34+
35+
function App() {
36+
return (
37+
<div className='control-section'>
38+
<PdfViewerComponent
39+
id="container"
40+
documentPath="https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf"
41+
resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
42+
style={{ height: '640px' }}>
43+
<Inject services={[Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, FormFields, FormDesigner]} />
44+
</PdfViewerComponent>
45+
</div>
46+
);
47+
}
48+
49+
ReactDOM.createRoot(document.getElementById('sample')!).render(<App />);
50+
{% endraw %}
51+
{% endhighlight %}
52+
{% endtabs %}
53+
54+
The Viewer requires **FormFields** and **FormDesigner** services for form interaction and design, and `resourceUrl` for proper asset loading in modern setups.
55+
56+
2. **Place a signature field (UI or API)**
57+
- **UI:** Open **Form Designer** → choose **Signature Field** → click to place → configure properties like required, tooltip, and thickness.
58+
![Signature Field](../../javascript-es6/images/ui-signature-edit.png)
59+
- **API:** Use `addFormField('SignatureField', options)` to create a signature field programmatically.
60+
61+
{% tabs %}
62+
{% highlight js tabtitle="Standalone" %}
63+
{% raw %}
64+
const viewerRef = React.useRef<PdfViewerComponent>(null);
65+
66+
const onDocumentLoad = () => {
67+
viewerRef.current?.formDesignerModule.addFormField('SignatureField', {
68+
name: 'ApproverSignature',
69+
pageNumber: 1,
70+
bounds: { X: 72, Y: 640, Width: 220, Height: 48 },
71+
isRequired: true,
72+
tooltip: 'Sign here'
73+
});
74+
};
75+
{% endraw %}
76+
{% endhighlight %}
77+
{% endtabs %}
78+
79+
3. **Apply a PKI digital signature (JavaScript PDF Library)**
80+
81+
The library provides `PdfSignatureField` and `PdfSignature.create(...)` for PKI signing with algorithms such as **SHA‑256**.
82+
83+
```ts
84+
import {
85+
PdfDocument, PdfSignatureField, PdfSignature,
86+
CryptographicStandard, DigestAlgorithm
87+
} from '@syncfusion/ej2-pdf';
88+
89+
// Load existing PDF bytes (base64/ArrayBuffer)
90+
const document = new PdfDocument(data);
91+
const page = document.getPage(0);
92+
93+
// Create a visible signature field if needed
94+
const field = new PdfSignatureField(page, 'ApproverSignature', {
95+
x: 72, y: 640, width: 220, height: 48
96+
});
97+
98+
// Create a CMS signature using a PFX (certificate + private key)
99+
const signature = PdfSignature.create(
100+
{ cryptographicStandard: CryptographicStandard.cms, digestAlgorithm: DigestAlgorithm.sha256 },
101+
certData,
102+
password
103+
);
104+
105+
field.setSignature(signature);
106+
document.form.add(field);
107+
108+
const signedBytes = await document.save('signed.pdf');
109+
document.destroy();
110+
```
111+
112+
N> For sequential or multi‑user flows and digital signature appearances, see these live demos: [eSigning PDF Form](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/esigning-pdf-forms), [Invisible Signature](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/invisible-digital-signature) and [Visible Signature](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/visible-digital-signature) in the React Sample Browser.
113+
114+
## How‑to guides
115+
116+
### Add a signature field (UI)
117+
Use the Form Designer toolbar to place a **Signature Field** where signing is required. Configure indicator text, required state, and tooltip in the properties pane.
118+
119+
![Signature Field](../../javascript-es6/images/ui-signature.png)
120+
121+
### Add a signature field (API)
122+
123+
Adds a signature field programmatically at the given bounds.
124+
125+
{% tabs %}
126+
{% highlight js tabtitle="Standalone" %}
127+
{% raw %}
128+
viewerRef.current?.formDesignerModule.addFormField('SignatureField', {
129+
name: 'CustomerSign',
130+
pageNumber: 1,
131+
bounds: { X: 56, Y: 700, Width: 200, Height: 44 },
132+
isRequired: true
133+
});
134+
{% endraw %}
135+
{% endhighlight %}
136+
{% endtabs %}
137+
138+
### Capture handwritten/typed signature in the browser
139+
140+
When users click a signature field at runtime, the Viewer’s dialog lets them **draw**, **type**, or **upload** a handwritten signature image—no plugin required—making it ideal for quick approvals.
141+
142+
![Signature Image](../images/handwritten-sign.png)
143+
144+
N> For a ready‑to‑try flow that routes two users to sign their own fields and then finalize, open [eSigning PDF Form](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/esigning-pdf-forms) in the sample browser.
145+
146+
### Apply a PKI digital signature
147+
148+
Use the **JavaScript PDF Library** to apply a cryptographic signature on a field, with or without a visible appearance. See the **Digital Signature** documentation for additional options (external signing callbacks, digest algorithms, etc.).
149+
150+
N> To preview visual differences, check the [Invisible Signature](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/invisible-digital-signature) and [Visible Signature](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/visible-digital-signature) in our Sample Browser. Digital Signature samples in the React sample browser.
151+
152+
### Finalize a signed document (lock)
153+
154+
After collecting all signatures and passing validations, **[Lock](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature#lock-signature)** the PDF (and optionally restrict permissions) to prevent further edits.
155+
156+
## Signature Workflow Best Practices (Explanation)
157+
158+
Designing a well‑structured signature workflow ensures clarity, security, and efficiency when working with PDF documents. Signature workflows typically involve multiple participants—reviewers and approvers each interacting with the document at different stages.
159+
160+
### Why structured signature workflows matter
161+
162+
A clear signature workflow prevents improper edits, guarantees document authenticity, and reduces bottlenecks during review cycles. When multiple stakeholders sign or comment on a document, maintaining order is crucial for compliance, traceability, and preventing accidental overwrites.
163+
164+
### Choosing the appropriate signature type
165+
166+
Different business scenarios require different signature types. Consider the purpose, regulatory requirements, and level of trust demanded by the workflow.
167+
168+
- **Handwritten/typed (electronic) signature** – Best for informal approvals, acknowledgments, and internal flows. (Captured via the Viewer’s signature dialog.)
169+
170+
![Handwritten Signature](../images/handwritten-sign.png)
171+
172+
- **Digital certificate signature (PKI)** – Required for legally binding contracts and tamper detection with a verifiable signer identity. (Created with the JavaScript PDF Library.)
173+
174+
N> You can explore and try out live demos for [Invisible Signature](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/invisible-digital-signature) and [Visible Signature](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/visible-digital-signature) in our Sample Browser.
175+
176+
### Pre‑signing validation checklist
177+
178+
To prevent rework, validate the PDF before enabling signatures:
179+
- Confirm all **required form fields** are completed (names, dates, totals). (See [Form Validation](../forms/form-validation).)
180+
- Re‑validate key values (financial totals, tax calculations, contract amounts).
181+
- Lock or restrict editing during review to prevent unauthorized changes.
182+
- Use [annotations](../annotation/overview) and [comments](../annotation/comments) for clarifications before signing.
183+
184+
### Role‑based authorization flow
185+
186+
- **Reviewer** – Reviews the document and adds [comments/markups](../annotation/comments). Avoid placing signatures until issues are resolved.
187+
![Reviewer using highlights and comments](../images/highlight-comments.png)
188+
- **Approver** – Ensures feedback is addressed and signs when finalized.
189+
![Signature Image](../images/handwritten-sign.png)
190+
- **Final Approver** – Verifies requirements, then [Lock Signature](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature#lock-signature) to make signatures permanent and may restrict further edits.
191+
192+
N> **Implementation tip:** Use the PDF Library’s `flatten` when saving to make annotations and form fields permanent before the last signature.
193+
194+
### Multi‑signer patterns and iterative approvals
195+
- Route the document through a defined **sequence of signers**.
196+
- Use [comments and replies](../annotation/comments#add-comments-and-replies) for feedback without altering document content.
197+
- For external participants, share only annotation data (XFDF/JSON) when appropriate instead of the full PDF.
198+
- After all signatures, **[Lock](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature#lock-signature)** to lock the file.
199+
200+
N> Refer to [eSigning PDF Forms](https://document.syncfusion.com/demos/pdf-viewer/react/#/bootstrap5/pdfviewer/esigning-pdf-forms) sample that shows two signers filling only their designated fields and finalizing the document.
201+
202+
### Security, deployment, and audit considerations
203+
204+
- **Restrict access:** Enforce authentication and role‑based permissions.
205+
- **Secure endpoints:** Protect PDF endpoints with token‑based access and authorization checks.
206+
- **Audit and traceability:** Log signature placements, edits, and finalization events for compliance and audits.
207+
- **Data protection:** Avoid storing sensitive PDFs on client devices; prefer secure server storage and transmission.
208+
- **Finalize:** After collecting all signatures, lock to prevent edits.
209+
210+
## See also
211+
- [Create and Modify Annotation](../annotation/create-modify-annotation)
212+
- [Customize Annotation](../annotation/customize-annotation)
213+
- [Digital Signature - JavaScript PDF Library](https://help.syncfusion.com/document-processing/pdf/pdf-library/javascript/digitalsignature)
214+
- [Handwritten Signature](../annotation/signature-annotation)
215+
- [Form Fields API](../form-fields-api)
216+
- [Add Digital Signature](./add-digital-signature-react)
217+
- [Customize Signature Appearance](./customize-signature-appearance)
218+
- [Signature workflows](./signature-workflow)

0 commit comments

Comments
 (0)