Tool reference
Example
// Every tool here is activated by its toolbar button or from code: await viewer.activateTool('highlight'); await viewer.deactivateTool();
Drawing tools (shared options bar: stroke and fill color, each with its opacity, and line width)
| Tool | Description |
|---|---|
| Draw | Freehand drawing with pointer events |
| Arrow | Drag-to-draw arrow with arrowhead |
| Line | Drag-to-draw straight line |
| Rectangle | Drag-to-draw rectangle (stroke + fill) |
| Ellipse | Drag-to-draw ellipse (stroke + fill) |
| Placed shapes | Hovering a drawn shape outlines it; clicking selects it with grips and an action bar with Duplicate, Color and Delete. While moving or resizing, pink guides appear when an edge or center lines up with another object or the page's center, and the object snaps to it. Stamps, images and added text select the same way, keep their proportions when resized, and stamps and text can be turned by 90° from the bar |
Annotations
| Tool | Description |
|---|---|
| Highlight | Draw a rectangle to create an area highlight. Its options bar carries one chip with the color and opacity, opening the shared color popover with the highlighter inks first; the choice is the shared highlight ink, remembered for the session and used by Mark text and the selection bar too |
Select (selectText) | Drag over text to select it. A bar appears with Highlight (its color chip opens the shared color popover, with highlighter presets, and the choice is remembered for the session), Comment (highlights the text and opens its card in the Comments panel), Underline, Squiggly underline, Strikethrough, Copy, and a More menu holding Add a note (hands the selection to the Note tool), Search for this, and Black out — which covers the text with an opaque box and says on the row that the text stays in the file (it is not redaction: nothing is removed from the file). The tool a document opens in and goes back to (see the resting tool): a click selects an annotation, links and fields answer, Ctrl/Cmd+C copies, and on a touch screen one finger scrolls while a long press selects a word |
Mark text (textHighlight) | Drag over text to highlight it, selecting exactly as the Select tool does (same text layer, same lines, same hit-testing); the selection is previewed in the ink and written as a highlight with one quad per run of characters. Same options bar and shared ink as Highlight |
| Note | Click to place a note. The composer shows who is writing (annotations.author, with initials) and offers four colors (or your annotations.noteColors), written to the annotation and shown on the pin; Esc discards, "Add note" (or Ctrl/⌘+Enter) adds. Click a pin to edit or delete it; drag to move it |
Text box (freeText) | Click to open a box where the pointer is and type a comment; it wraps at its width and grows as you type, in the options bar's font (Helvetica, Times or Courier), size, color and alignment; words those fonts cannot draw (Cyrillic, Greek, CJK, Arabic …) are drawn in a bundled face for their script, so the box shows in every reader. Ctrl/⌘+Enter or a click away commits, Enter is a new line, Esc discards. Written as a free-text annotation, so any reader can select, move, restyle, reply to and remove it; a placed box selects like a shape, with Edit beside Duplicate and Delete, and resizing re-wraps the words |
| Link | Drag a rectangle, or click an existing link to change it. The dialog asks where the link goes to: a web address (shown as it will be saved — a bare example.com becomes https://example.com; only http, https, mailto and tel can be saved, anything else is refused inline with Save disabled) or a page in this document (a thumbnail of the typed page, because a page number on its own is not something anyone can verify). The text under the rectangle is quoted so the dialog says what it is about. Editing shows Remove on the left, away from Save |
| Stamp | A stamp goes into the file named (the id doc.annotations works by, kept across moves and turns) and with its wording as its subject (in the viewer's language: a standard wording title-cased, Draft, Not For Public Release; your own as typed; a mark's name; Stamp for a picture), which is what Acrobat's and every other Comments pane lists it as. A panel of stamps drawn at their real proportions, in two sets — Standard and Yours, as tabs — under a head that stays in view however many stamps there are: New stamp, and a fold that shrinks the panel to its head to clear the page (both kept while the viewer is open). On a desktop the panel is a card at the top-left corner of the pages that stays put as they scroll either way, fits the viewer's height whatever the window's, and gives the page bar way; on a phone or a tablet it is the sheet's content. Standard — a tick, a cross and a dot first (20-point marks for forms and checklists: the tick green, the cross red, the dot black), then APPROVED, REJECTED, NOT APPROVED, COMPLETED, REVISED, DRAFT, FINAL, FOR COMMENT, PRELIMINARY, CONFIDENTIAL, TOP SECRET, FOR PUBLIC RELEASE, NOT FOR PUBLIC RELEASE, VOID, EXPIRED, AS IS, and SIGN HERE, INITIAL HERE and WITNESS on a ribbon — With today's date (RECEIVED — the date is burned in at placement). Yours holds custom images and the stamps the user makes; a stamp just made opens there, chosen. "New stamp" builds one from text (ink, optional date, Boxed / Plain / Ribbon border), an image, or a region dragged out of a page — lifted at up to 6 pixels per point (at most two megapixels), sharp in print — previewed at real size with its point dimensions; it is kept for the session. The chosen stamp follows the cursor; click to place, then move, resize (proportions kept) or rotate it before committing with Enter. It is written at the resolution it is shown at, or a picture's own when that is finer (up to 6 pixels per point), so it stays sharp at any size |
Marks (check, cross, dot) | One click places a tick, a cross or a dot, the marks a form filler reaches for, as stamps that move and resize like any stamp; the tool stays armed, so box after box takes one click each, and Escape leaves the tool. Their bar sets the color (plain pen-dark to start, the palette's swatches) and the size (annotations.markSizes, 20 pt to start), shared by the three and kept for the session. Each is a tool of its own (tools.check, tools.cross, tools.dot), so a host offers three, two or none; the Marks menu goes with its last member. Under the annotations feature |
| Image | "Add an image": drop it, paste it from the clipboard, or choose a file (PNG, JPEG, WebP, GIF or BMP, up to 10 MB unless tools.image sets other limits); images inserted this session are offered under Recent. The image follows the cursor; click to place with drag/resize handles. Esc puts it down, and a click on the page asks again |
Signature: a modal for electronic signatures, with up to three tabs (tools.sign chooses which, and the Type tab's faces)
| Tab | Description |
|---|---|
| Type | Full name and initials, four inks (or your tools.sign.inks), previews in your own name |
| Draw | A pad with a baseline to sign above and a Nib slider (1–5 pt); a mouse signature at 1 pt looks like a scribble, at 3 pt like ink |
| Upload | A photo of a wet signature. The paper is lifted off by default — the paper level is read from the photo itself, so gray or shadowed paper works — with As uploaded one click away |
Notes
Add Text. Click, type, done. The cursor is a text caret; the click is the baseline — where the first character sits, not the top of a box — and an input opens there. You type at final size: the preview is the size the PDF will use, and changing font, size, bold, italic, color or alignment on the Text options bar while typing changes the text in front of you, not just a setting for next time. Enter commits; the text becomes a placed object with the same handles as a stamp or an image, and an action bar with Edit, Duplicate, Rotate 90° and Delete. Escape, or clicking away with nothing typed, leaves no trace. Supports 3 standard PDF fonts (Helvetica, Times, Courier with bold/italic variants) plus 58 bundled OFL-licensed fonts (Noto Sans/Serif with italics, Noto Sans Mono, Noto CJK, script-specific Noto faces for 26 scripts, Noto Sans Symbols, Symbols 2 and Math for the check marks, ballot boxes, bullets, arrows and operators forms carry, and the metric-compatible Arimo (with italic), Tinos, Cousine, Carlito, Caladea and Gelasio for Arial, Times New Roman, Courier New, Calibri, Cambria and Georgia) with full non-Latin script support. Each face is downloaded on first use, never at document open. Needs add-text; see Fonts.
Edit Text. Activates per-block text editing on existing PDF text. Double-click a text block to enter inline edit mode. The block being edited is shown exactly as it will be written. Dragging a block moves it. The original stays grayed in place until the pointer is released, so the move can be judged before it is made; pink guides snap the block to the left and right edges and the tops and bottoms of the blocks around it, and a readout gives the destination in points from the page's top-left. Features: live re-rendering on each keystroke; font family, size, bold, italic, color changes via toolbar; drag-and-drop repositioning of text blocks; delete a block with the trash button on the Text options bar — it asks first (confirmations.deleteTextBlock), since the deletion joins the session's one undo step; every change is one undo step. Done applies the edits and leaves the tool, and so does every other way out — Escape, another tool, deactivateTool(), destroy() over an open document: nothing is thrown away by accident. Undo backs the session out as one step, and Redo brings it back; viewer.tools.editText.cancel() is the one way to discard. A reload of the page is the host's to guard, with hasPendingEdits in a beforeunload handler. Every commit reports textChanged once, with every block it wrote (and documentChanged, as every change does) — see What you can replace. Embedded font warning indicator for subset fonts. Needs edit-text; see viewer.tools.editText.
Drawing tools. All drawing tools show an SVG live preview during drawing, then write a real annotation — an ink annotation for Draw, square, circle and line annotations for the shapes, an arrow being a line with an open arrowhead, as Acrobat draws it — with its color, width and opacity stored on the annotation and a drawn appearance (for an arrow, an arrowhead the SDK draws itself). Acrobat and every other reader therefore draw it the same way, and can select, move, comment on and remove it as a comment. Each shape carries one opacity: the stroke's, or the fill's for a shape with no stroke. Shapes are signed with annotations.author.
Selecting annotations already on the page. Annotations the document came with — made in Acrobat or another reader — select like the ones drawn in the viewer: a click in Select — the tool a document opens in — that selects no text, a tap in it, or a click with Pan or no tool picks up the annotation under the pointer, the smallest first; a press with a drawing tool picks up a shape, drawing, line, stamp or text box, never a text markup, so a stroke can start over a highlight. This needs the annotations feature, a document that allows comments, and the Erase tool on (FULL mode, and not switched off in tools).
Rectangles, ellipses, polygons, polylines, drawings, lines, stamps and text boxes move and resize with grips and the arrow keys, and are deleted from the action bar or with Delete; a polygon's or polyline's corners scale with its box. Highlights, underlines, strikeouts and squiggly underlines stay on the words they mark: selected, they offer Color and Delete, and their comment opens in the Comments panel. Color recolors a rectangle, ellipse, polygon, polyline, drawing, line, arrow or text markup, with its opacity; a highlight's picker offers the highlighter's colors first. Each pick shows at once; the change is one undo step when the selection ends. A text box's and a stamp's colors are part of their content and are not offered.
Such an annotation is changed where it is, not rewritten: it keeps its name, author, replies, pop-up and every entry the viewer does not edit, and the picture its reader drew (a cloud, a dashed border) is fitted to its new box rather than drawn again. Notes keep their pins, links their tool, and form fields are filled, not moved. Read-only, locked and hidden annotations are left alone.
Erase. A brush that removes whatever falls under it. A ring drawn at the brush's real size stands in for the cursor, so reach is visible before anything is under it; a Size slider on the options bar sets it (6–64 pt unless tools.erase sets another range; remembered for the session). Whatever the ring reaches is outlined and named before the press — "Will remove: text ×4", "Will remove: arrow" — with annotations drawn in this session named by the tool that drew them and everything else by its kind. Erase removes page objects as well as annotations, so it can take document content (a logo, a table rule); naming the target first is the point of the label. A press takes everything the ring touches; holding and dragging keeps taking as the ring passes over things, and the whole stroke is one undo entry. A multi-object annotation (an arrow is a shaft and a head) goes as a whole. A page-sized background — a fill, a full-bleed image — is what the brush is inside, not what it is on: it is left alone while there is anything else to take, a press on nothing but background takes it (the label says so first), and a stroke across empty paper takes nothing.
Signature. Signatures are stamped as image objects into the PDF. The tabs are in the table above; see Tools for tools.sign.
Search. Floating search bar (Ctrl+F) with: real-time search across all pages; yellow highlight overlays for all matches, orange for current match; prev/next navigation with wrap-around and match count ("N of M"); auto-scroll to match page.
Pan. The hand. Drag the page to scroll it; nothing is written to the document.
Security. Protects the document with AES-256. The dialog separates the two jobs a PDF's security can do, each switched on deliberately: Require a password to open — the open (user) password. Nobody can read the file without it; this is the encryption. A strength meter says which band the password is in and what would move it up. Restrict what people can do — printing (and full-quality printing), copying, form filling, editing, comments, and page changes, grouped by what a reader is trying to do, as the booleans of DocumentPermissions. Accessibility extraction is never restricted.
Restrictions are only real while the owner password is different from the open password: a reader who holds the owner password can lift them, so the dialog will not apply restrictions without a distinct owner password, and says why. With nothing restricted, no owner password is needed — the open password stands in, which lifts nothing. doc.security.protect() applies the same rule and throws INVALID_ARGUMENT otherwise. Already-protected documents open to a summary — the encryption, whether this session holds owner rights, and what readers may and may not do — with Change and Remove. Removing protection asks for the owner password first and then confirms in plain words that the file will no longer be encrypted. Settings apply when the document is next saved or downloaded. Enable or hide the tool with tools.security. Needs export.
Manage Pages. Modal dialog for page operations — selection first, actions second. The header says what is there ("6 pages · 2 selected") and holds the two things that need no selection, New page and Import PDF; the grid gets the room, with an Add page tile at its end and a rotation badge (90°, 180°, 270°) on any page that has been turned. An action bar appears only once something is selected: Rotate left / Rotate right, Duplicate, Extract selected pages as a new PDF download, Delete (refused when it would take every page). Reorder by dragging a page's grip handle; a line shows where the page will land. Works with mouse, pen and touch alike; native HTML5 drag on the tile itself still works for a mouse. The grip is always visible on touch devices, where there is no hover. On a touch screen a page can also be moved by pressing and holding it. Selection: Click, Ctrl+Click (toggle), Shift+Click (range), Ctrl+A or Select all (select all), Select none to clear; Delete or Backspace deletes the selection. Apply changes commits; Cancel, the close button, Escape or a click beside the dialog discards everything done in it — after "Discard page changes?" once something was changed, and Delete asks "Delete this page?" first (both switchable in confirmations). Needs edit-pages; Extract needs export too.
Every action runs the same code as doc.pages, under the same license checks. One that fails — a file that cannot be imported, an import under a license stopped since the document opened, a page that cannot be turned or copied, a page tree nested too deeply to change — is reported on the error event, and the grid shows the pages as they then are. Import PDF asks for no password: import an encrypted file with doc.pages.import(bytes, { position, password }). Pages with form fields are imported and extracted flattened, as they print, as doc.pages does. A change your code makes while the dialog is open (doc.pages, doc.annotations) is made to the document with the dialog's changes in it: the dialog closes, keeping them, and one undo takes both back. On a narrow viewport the dialog goes full-bleed and its action row wraps, so every action stays reachable without horizontal scrolling. No host-side handling is required.