StaticALLOW_Whether annotations can be dragged outside the page (off by default: dragging stops at the page edge and does not move in a direction where the annotation is larger than the page).
Whether annotations can be dragged outside the page (off by default: dragging stops at the page edge and does not move in a direction where the annotation is larger than the page).
With the link tool on, pressing a hand-drawn link selects, drags and resizes it (otherwise a click follows it).
Creates a tool.
The document viewer the tool works on.
Adds a custom stamp (filling in defaults for missing fields) and fires stampsUpdated.
The custom stamp.
Places the current stamp at location (centered on it; multiplied by setStampScaleFactor; drawn with setCustomDrawFunction first if set).
StaticallowAllows annotations to be dragged outside the page (sets ALLOW_ANNOTS_OUTSIDE_PAGE to true).
Removes all document stamps and fires stampsUpdated.
Called when the context menu is requested on the viewer; does nothing in the base class.
The mouse event.
Custom stamp → image stamp (drawn by drawCustomStamp; width and height are half the canvas, in pt); falls back to the engine text stamp without a canvas.
Deletes by object reference (pass the objects from getCustomStamps); missing ones log a warning.
StaticdisableTurns off hover cursors: the tool's own cursor is always used (sets ENABLE_ANNOTATION_HOVER_CURSORS to false).
StaticdisableTurns off automatic text selection by the edit tool (sets ENABLE_AUTO_SWITCH to false).
Selects an annotation when the press is released (the default); the press does not drag it.
StaticdisallowKeeps dragged annotations inside the page (sets ALLOW_ANNOTS_OUTSIDE_PAGE to false; the default).
Draws a custom stamp on canvas: a rounded background box, the title (smaller font when it does not fit), and the subtitle below when present (a date in moment format, with $currentUser replaced by the current user). Returns the stamp width (half the canvas pixels).
Optionalcanvas?: HTMLCanvasElementCanvas to draw on; a new canvas when omitted.
OptionalcanvasParent?: HTMLElementElement whose width limits the title width; 520 pixels when omitted.
Optionalheight?: numberStamp height (half the canvas pixels); 100 by default.
Optionalwidth?: numberMinimum stamp width (half the canvas pixels); 300 by default.
StaticenableTurns on hover cursors (sets ENABLE_ANNOTATION_HOVER_CURSORS to true).
StaticenableTurns on automatic text selection by the edit tool (sets ENABLE_AUTO_SWITCH to true).
Selects an annotation as soon as it is pressed, so it can be dragged in the same gesture (text markup is still selected on release).
Creates a stamp annotation for each custom stamp.
The stamp annotations, not added to the document.
Gets the custom stamps.
A copy of the custom stamp list.
Built-in standard stamp names.
Input of the last setDocumentStamps (a copy).
Optionaloptions?: DocumentStampOptionsThe registration options.
The registered stamp sources.
Viewport event → the page and page coordinates under the pointer (unrotated page, top-left origin, pt).
Draws a preview image (dataURL): the stamp is fitted proportionally into canvasWidth × canvasHeight (getPreview).
Height of the preview image in pixels.
Width of the preview image in pixels.
Optionaldirection?: "ltr" | "rtl"'rtl' aligns the stamp to the right of the image; left by default.
Optionaltext?: stringReplaces the text of a text stamp before drawing.
One StampAnnotation (not placed) per standard stamp: Icon is the stamp name for standard stamps; image URLs become image stamps; document stamps follow.
Gets the standard stamp names offered by the tool.
A copy of the stamp names.
label is "title page".
Removes the preview that follows the pointer.
No stamp chosen (the current one is not a StampAnnotation).
Called when a key is pressed while the viewer has focus; does nothing in the base class.
Fires annotationDoubleClicked; free text enters inline editing.
With a stamp pending, a press places the stamp: pressing another annotation neither selects nor drags it; without a pending stamp, pressing an existing annotation selects and drags it as usual.
Called when the left mouse button or a touch is released; does nothing in the base class.
Called when the pointer moves over the viewer; does nothing in the base class.
Called when the right mouse button goes down on the viewer; does nothing in the base class.
The pointer event.
Removes every listener of every event.
Draws on the stamp image before placement (callback(ctx, annotation?)); the placed stamp becomes an image stamp.
Fills in id and category for each (default 'Custom Stamp').
Registers pages of another PDF as stamps (calling again replaces the previous registration). Note: each page is rendered as an image (at DOCUMENT_STAMP_SCALE), not a vector appearance; with cropVisibleContent the surrounding blank space (white or transparent) is cropped.
Optionaloptions: DocumentStampOptionsStaticsetSets the maximum size when resizing annotations.
StaticsetSets the minimum size when resizing annotations (static, shared by all select / edit tools).
Sets the name of the tool.
The tool name.
A click then places this stamp (once).
Optionaltext: stringWidth and height are multiplied by this on placement (1 by default; must be positive).
Standard stamp names, or image URLs (http(s) / data:, made into image stamps); unknown names are removed.
Changes the tool's default style (used by annotations created afterwards); fires toolUpdated.
const { documentViewer, Annotations, Tools } = instance.Core;
const freeTextTool = documentViewer.getTool(Tools.ToolNames.FREETEXT);
freeTextTool.setStyles({ TextColor: new Annotations.Color(0, 0, 0), FontSize: '14pt', Font: 'Helvetica' });
documentViewer.getTool(Tools.ToolNames.HIGHLIGHT).setStyles({ StrokeColor: new Annotations.Color(0, 255, 0), Opacity: 0.6 });
Shows the preview at the last pointer position (showPreview; our preview is drawn on the annotation layer).
Called on a tap (a touch press and release without moving); does nothing in the base class.
The pointer event.
Keeps placing this stamp (Icon is a standard stamp name, or give a StampAnnotation) until another is chosen.
OptionalFillColor?: ColorFill color; black by default.
OptionalHeight?: numberHeight in PDF points; 0 (natural size) by default.
OptionalIcon?: stringStandard stamp name.
OptionalOpacity?: numberOpacity from 0 to 1; 1 by default.
OptionalWidth?: numberWidth in PDF points; 0 (natural size) by default.
Preview following the pointer (not added to the document).
The tool's own cursor: used when switching in and when hovering over empty space (default for the edit tool, crosshair for creation tools, text for text tools, grab for pan...).
Default style of annotations created by the tool (such as StrokeColor, StrokeThickness, Opacity); changed with setStyles.
StaticENABLE_Changes the cursor on hover by what is under the pointer (annotations, handles, text); the stamp, attachment, eraser and marquee zoom tools turn it off, and it is turned back on when they switch out (Tool.ENABLE_ANNOTATION_HOVER_CURSORS).
StaticENABLE_Whether the edit tool selects text automatically when hovering over text (the edit tool selects text itself, so when this is off it neither selects text nor shows the text cursor; the instance enable / disableTextSelection must also be on). Turned off on touch screens.
Static ReadonlyEventsEvent names of the rubber stamp tool.
ReadonlyANNOTATION_ADDED: "annotationAdded"'annotationAdded': a stamp was placed.
ReadonlyCUSTOM_STAMPS_DELETED: "customStampsDeleted"'customStampsDeleted': custom stamps were deleted; receives the deleted stamps.
ReadonlySTAMPS_UPDATED: "stampsUpdated"'stampsUpdated': the standard, custom or document stamps changed.
Static ReadonlyFILL_Default background colors of custom stamps.
Placement position (set by mouseLeftUp; can also be set before calling addStamp).
Page number (1-based).
X of the stamp center in PDF points.
Y of the stamp center in PDF points.
Name the tool is registered under (one of ToolNames).
Static ReadonlyTEXT_Default text colors of custom stamps.
Static ReadonlyTIMESTAMP_Date format choices for custom stamp subtitles.
Choice id.
Date format of the subtitle ('other' for a custom format).
Base class for objects that fire named events. Listener arguments are passed by position.