Web SDKv1.0.0

tools.sign

Signature tool. Needs the annotations license feature (signing a form's signature field needs forms). Sign is also offered in 'form-fill' mode, for your own button. The same dialog opens from the Sign tool and from a form's signature fields, so tools.sign shapes both. true is the same as {}: every tab, the built-in faces. With one tab left the dialog shows no tab strip. With every tab off there is no way to make a signature: the Sign tool is hidden and signature fields are read-only. tools.sign: false only hides the tool — form signature fields still open the full dialog.

A signature made in a form's signature field is saved as that field's appearance, cropped to its ink so it fills the field: every reader shows it in the field and prints it, the export's flatten locks it into the page with the other fields, and the field stays a signature field. It is an electronic signature, not a digital one — nothing is written as the field's signature value, so the file claims no digital signature, and a digital ID applied later in another application replaces the picture. The SDK never draws over a field that holds a digital signature, nor into a read-only or hidden one. A field that already shows a signature (saved by the SDK or another application) shows it as the page draws it, without the "Sign here" prompt, and can be signed again; one that holds a digital signature cannot (FormFieldInfo.signature). To replace the dialog entirely, see callbacks.onSignatureRequest.

boolean | SignatureConfigdefault on, within the mode

Example

signTypeScript
import { SIGNATURE_FONTS } from '@kernstra/pdf-web-sdk';

tools: {
  sign: {
    upload: false,
    fonts: [...SIGNATURE_FONTS, { family: "'Acme Script', cursive", label: 'Acme' }],
  },
}

Options 7

drawbooleanDefaulttrue
Offer the Draw tab.
typebooleanDefaulttrue
Offer the Type tab.
uploadbooleanDefaulttrue
Offer the Upload tab.
fontsreadonly SignatureFont[]DefaultSIGNATURE_FONTS
Faces the Type tab offers. Each SignatureFont is { family, label }: family a CSS font-family value — load the face yourself (@font-face) — and label the name shown beside the preview. fonts replaces the Type tab's faces, in order; an empty list keeps the default. The built-in faces' names ("Standard", "Script", …) follow the viewer's language when you pass the SIGNATURE_FONTS objects themselves — spread the constant; a face you describe yourself shows the label you gave it.
inksColorListDefaultblack, navy, blue, red
Inks a signature can be written in, first ink selected. A ColorList is a list of hex strings or { color, label } color options (see Annotations).
savedSignaturesreadonly SavedSignature[]
Signatures to offer for reuse, restored. The dialog keeps up to three signatures the user chose to save; they last for the session unless you keep them — store what the savedSignaturesChanged event gives you and pass it back here. The list is shared by every viewer on the page. See What you can replace.
webFontsbooleanDefaultfalse

Fetch the Type tab's script faces from Google Fonts. Beside its plain Standard face, the Type tab offers four script faces (Dancing Script, Great Vibes, Pacifico, Sacramento). By default they are not fetched: each renders in a handwriting face the operating system ships (Snell Roundhand, Apple Chancery, Marker Felt and Savoye on a Mac; Segoe Script, Lucida Handwriting, Segoe Print and Lucida Calligraphy on Windows, or Office's Edwardian Script and Monotype Corsiva where they are installed), and the dialog makes no network request, which keeps the SDK's no-Google-Fonts guarantee intact. Set it where a request to Google is acceptable to you and your users, and add https://fonts.googleapis.com to style-src and https://fonts.gstatic.com to font-src. Either way the dialog never waits on the font host; faces that have not arrived by the time a signature is placed fall back to the system face for that signature.

It is read from tools.sign as an object: with tools.sign: false the faces stay off for a form's signature fields too. To hide the tool and keep them, leave tools.sign on and drop the tool from toolbar.groups.

sign.webFontsTypeScript
tools: { sign: { webFonts: true } }

More in Tools