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.
Example
// 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
builtIn: false, presets are listed alone.builder: false takes "New stamp" and the stamps made with it off the picker.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.tools: { stamp: { builtIn: true, custom: [{ label: 'Logo', url: '/stamps/logo.png' }] } }
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.ColorList is a list of hex strings or color options (see Annotations).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.