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.
StaticallowAllows annotations to be dragged outside the page (sets ALLOW_ANNOTS_OUTSIDE_PAGE to true).
Called when the context menu is requested on the viewer; does nothing in the base class.
The mouse event.
Makes an image file into an image stamp, scaled to fit 200 pt square, centered on pageCoordinates on that page, and adds it to the document (used for pasting clipboard images). Fires fileRejected and returns null when the type is not in ACCEPTED_IMAGE_TYPES, the size exceeds ACCEPTED_FILE_SIZE, or decoding fails.
Page number (1-based).
X of the stamp center in PDF points.
Y of the stamp center in PDF points.
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).
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).
Viewport event → the page and page coordinates under the pointer (unrotated page, top-left origin, pt).
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 an image pending, a press places the stamp and pressing another annotation does not select it; without one, pressing an existing annotation selects and drags it as usual, and only empty space places an image.
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.
StaticsetSets 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.
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 });
Called on a tap (a touch press and release without moving); does nothing in the base class.
The pointer event.
Maximum file size (bytes) accepted by createAnnotationFromFile; larger files fire fileRejected; null, 0 or less means no limit.
Image types accepted by createAnnotationFromFile (comma separated: mime, image/, .extension), also the file picker's accept; all images (image/) by default.
Preview following the pointer (not added to the document): only after armImage.
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 image stamp tool.
ReadonlyANNOTATION_ADDED: "annotationAdded"'annotationAdded': an image stamp was added to the document.
ReadonlyANNOTATION_CREATED: "annotationCreated"'annotationCreated': an image stamp was created.
ReadonlyFILE_REJECTED: "fileRejected"'fileRejected': an image file was rejected (type, size or decoding).
Name the tool is registered under (one of ToolNames).
ToolNames.STAMP: after a click, pick an image (file picker) and place it as an image stamp at the click, scaled to fit 200 pt square by its aspect ratio and centered on the click. pickImage can be overridden (for example to take the image from the clipboard or your own dialog); it returns a dataURL, null means cancelled.