Skip to content

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

Signatures ​

The WebViewer supports both electronic signatures (drawn/typed/uploaded) and digital signatures (certificate-based). This guide covers the UI-side signature APIs and components.

Signature cryptography and the PDF integration belong to the Core. The UI drives them through instance.Core and keeps the saved signatures and the verification results in its stores.

UI APIs ​

Show / hide the signature tools ​

The signature tools are the grouped items fillAndSignGroupedItems of the toolbar group toolbarGroup-FillAndSign:

javascript
UI.disableElements(['fillAndSignGroupedItems']);
UI.enableElements(['fillAndSignGroupedItems']);

Auto-jump ​

javascript
UI.enableFeatures([UI.Feature.AutoJumpNextSignature]);

When enabled, the viewer jumps to the next signature field after one is signed.

Signature dialog configuration ​

javascript
UI.setSignatureDialogTabs(['keyboard', 'trackpad']);             // tabs shown in the dialog
UI.enableFeatures([UI.Feature.SignatureTemplates]);              // enable signature templates
UI.setSignatureDialogProperties('trackpad', { colors: ['#000000', '#FF0000'], lineWidth: 2 }, false);
APIPurpose
setSignatureDialogTabs(tabs)The tabs shown in the signature dialog and their order: 'keyboard', 'trackpad', 'image'.
enableFeatures / disableFeatures([UI.Feature.SignatureTemplates])Enable/disable signature templates (saved signatures).
setSignatureDialogProperties(type, properties, replace = false)Set colors, enableCustomColor, fonts (keyboard only), enableLineWidth and lineWidth (trackpad only) for 'keyboard' or 'trackpad'. With replace the given properties replace the whole tab; otherwise they are merged. A font is a font name or { fontFamily, label, fontWeight }: label is the text on the preview card before anything is typed (the font name by default), and fontWeight (such as 700, default 400) is used to show and draw the signature.
setMaxSignaturesCount(count)The maximum number of saved signatures.
setSignatureFonts(fonts)The fonts of typed signatures. It also clears the label and fontWeight set with setSignatureDialogProperties.
setSelectedTab('signatureModal', tab)Select a tab: textSignaturePanelButton, inkSignaturePanelButton or imageSignaturePanelButton.

Signature state ​

StatePurpose
Saved signatures / initials / digital signaturesSaved for the instance and restored next time.
Signature dialog tabs and propertiesSet by the APIs above.
Verification resultsResults of Document.verifySignatures(), shown in the signature panel.
Trusted certificatesAdded with UI.VerificationOptions.addTrustedCertificates(certificates), or by the user with Trust in the certificate viewer (which fires UI.Events.TRUSTED_CERTIFICATE_ADDED). Files and bytes are read when added; URLs are kept and downloaded again at every verification (each document load and re-verification), and a URL that cannot be downloaded is skipped for that verification with a console error. The list is kept in memory only.

Signature components ​

  • Signature dialog (signatureModal) — create an electronic signature by typing, drawing or uploading an image.
  • Digital signature dialogs (digitalSignatureModal, signatureAppearanceModal) — choose a certificate and the appearance.
  • Signature panel (signaturePanel, a tab of tabPanel) — the signatures of the document and their verification status.
  • Signature details (signatureDetailsModal, certificateViewerModal) — signer and certificate details.

Core (signature surface) ​

APIPurpose
documentViewer.getTool(Tools.ToolNames.SIGNATURE)The electronic signature tool.
UI.signSignatureWidget(widget, signature)Sign a signature field.
annotationManager.sign(...)Apply a digital signature.
documentViewer.getDocument().verifySignatures()Verify the signatures of the document.

See Digital Signatures.

Examples ​

Enable auto-jump and open the signature tools ​

javascript
UI.enableFeatures([UI.Feature.AutoJumpNextSignature]);
UI.setToolbarGroup('toolbarGroup-FillAndSign');

Configure the signature dialog ​

javascript
UI.setSignatureDialogTabs(['keyboard', 'trackpad', 'image']);
UI.setSignatureDialogProperties('keyboard', { colors: ['#000000', '#2D7CF6'] }, false);
UI.setMaxSignaturesCount(5);

Select the drawing tab of the signature dialog ​

javascript
UI.setSelectedTab('signatureModal', 'inkSignaturePanelButton');