Web SDKv1.0.0

tools.stamp

Stamp tool. Needs the annotations license feature. Takes a StampConfig object (or true, the same as {}). With builtIn and builder off and neither custom nor a valid preset there is nothing to place, and the Stamp tool is hidden.

A picture stamp is kept as a PNG data: URL, and one lifted from a page is part of that document — so whatever stores the list holds a copy of it. A region is lifted with at most two megapixels (a seal-sized one at 432 dpi): a lift of a whole scanned page can take a few megabytes, past what localStorage holds in some browsers. Size the store for it, and keep the list for the session only where documents are confidential. A kept stamp larger than a PDF page (14,400 points a side) or a wording longer than 32 characters is skipped when restored.

boolean | StampConfigdefault on, within the mode

Example

stampTypeScript
// Your own wording stamps instead of the English set
tools: {
  stamp: {
    builtIn: false,
    presets: [
      { label: 'GENEHMIGT', color: '#2E7D32' },
      { label: 'EINGANG', color: '#C62828', dated: true, border: 'ribbon' },
    ],
  },
}

Options 6

builtInbooleanDefaulttrue
Show the tick, cross and dot, the standard set and RECEIVED with today's date. With builtIn: false, presets are listed alone.
builderbooleanDefaulttrue
"New stamp" and the stamps made with it. builder: false takes "New stamp" and the stamps made with it off the picker.
custom{ label: string; url: string }[]
Your own stamp images, listed under Yours next to the stamps the user makes, at their own proportions and at most 200 pt wide. A data: URL whose header claims a raster too large to decode (over 64 million pixels, or a side over 16384 px) is left out with a console warning. A stamp image url on another origin needs that origin in connect-src or img-src.
stamp.customTypeScript
tools: { stamp: { builtIn: true, custom: [{ label: 'Logo', url: '/stamps/logo.png' }] } }
presetsreadonly StampPreset[]
Your own wording stamps, listed with the standard set — the words are written into the document exactly as you give them, so give them in your users' language — after the standard set (a dated one under "With today's date"), or alone with builtIn: false. They cannot be removed from the picker. A StampPreset is { label, color?, dated?, border? }: label the wording (e.g. 'PAID', 'BEZAHLT'), color a hex ink (default: the first of inks), dated adds the placing date under the wording (default false), border is 'boxed' (default), 'ribbon' or 'plain'. A label is trimmed; one left empty is skipped with a console warning, as is one whose color is not a hex color (only a preset with no color at all takes the first ink). #rgb is expanded to #RRGGBB.
inksColorListDefaultred, blue, green, black
The inks "New stamp" offers. A ColorList is a list of hex strings or color options (see Annotations).
userStampsreadonly SavedStamp[]
Stamps the user made before, to restore. Stamps made with "New stamp" last for the session; to keep them, store what the userStampsChanged event gives you and pass it back here. At most eight are kept, shared by every viewer on the page. See What you can replace.

More in Tools