The viewer
A complete editing screen: header, ribbon tabs, tool row, side panels and the pages.
Layout
- Header: menu (open, download, save, import and export annotations, flatten), thumbnails, zoom, the ribbon tabs, Open, Save, search and comments.
- Tool row: the tools of the open tab, followed by the style palette, undo, redo and the eraser.
- Panels: thumbnails, comments, search, the Style panel, stamps and signatures.
- Pages: scroll, zoom, a floating page navigator, and hover tips on annotations.
| Tab | Tools |
|---|---|
| Edit Text (PDF) | Edit the PDF’s own text like a Word document: click any text and type; font, size, bold, italic, underline, colour, alignment; move or widen a block; add new text; delete text. Its pictures too: drag to move, handles to resize, turn, replace, delete, add an image. Tables: draw one, type in its cells (Tab to the next), drag its edges, add or delete rows and columns, cell and border colours |
| View | Previous and next page, rotate, fit width, fit page, page layout (single, double, cover and double), continuous or page-by-page scrolling, light and dark theme |
| Annotate | Highlight, underline, strike-out, squiggly, pen, highlighter, text box, insert text, replace text, sticky note |
| Shapes | Rectangle, ellipse, line, arrow, polygon, polyline, cloud, arc |
| Insert | Stamps, signature, image, add page |
| Edit | Rotate, insert, delete and move pages, flatten |
| Fill and Sign | Signature, text, check mark, cross, dot, today’s date |
In a PDF, Edit Text changes the page itself (not an annotation): the text keeps the PDF’s own font when it has the letters, else a real font is fetched (fontUrl) and included in the file; the page’s pictures move, resize, turn, change and go the same way. Word documents get Word’s own Edit Text tab with Word’s formatting tools; workbooks open in a spreadsheet grid with Excel’s Home tab, and the PDF tabs annotate the grid itself: marks sit on their cells, scroll and zoom with them, and show on Home too, where a click picks one up to move, restyle or delete it (a click beside it edits the cells). One undo covers the cells and the marks, in the order they changed.
Options
| Option | Meaning |
|---|---|
document, fileName, password | The file to open |
theme | light, dark or auto |
accentColor | Your brand colour, e.g. #0a7d5a |
author | Name written into new annotations |
readOnly | View only, no editing tools |
tools | Tools to show, e.g. ['highlight', 'note', 'ink'] |
initialTab | view, annotate (default), shapes, insert, edit, sign or pdftext (Edit Text in a PDF) |
initialZoom | A number (default 1.25), fitWidth or fitPage |
layout | Page layout: single (default), double (two pages side by side) or cover (the first page alone, then two side by side) |
scrollMode | continuous (default) or page (one page, or pair, at a time) |
disabledElements | Hide parts: open, save, download, search, comments, thumbnails, tabs, toolbar, tab:<id>, tool:<name> and more |
headerButtons | Your own buttons: [{ id, label, title, icon, onClick(viewer) }] |
onSave(bytes, info) | Save handler, e.g. upload to your server (default: download) |
fontUrl | Where to fetch fonts for Word and Excel files, and for PDFs whose fonts are not included |
licenseKey | Your DocuVerse Web SDK licence key (a Mobile SDK key with appId). Without a key no document opens (the viewer shows where to get one); a trial key, from a free account, works with a watermark. A key for another SDK, like a Server SDK key, is refused: the viewer says which key to make |
licenseServer | Another licence server than the one the key names (false: none). The key is checked there; it lists the website or app it runs in and how many documents were opened (counts only); a revoked or ended licence shows the watermark, a renewed one is picked up by itself |
appId | In a mobile app (the viewer in a web view): the app’s id, like com.acme.reader; the key must be for mobile apps and name the app |
wasm | Where to load uds_pdf.wasm from |
Methods
loadDocument(src, { fileName, password }), save({ incremental }), download(), setTool(name), getTool(), setRibbon(tab), setZoom(n | 'fitWidth' | 'fitPage'), goToPage(i), setLayout('single' | 'double' | 'cover'), setScrollMode('continuous' | 'page'), getLayout(), setTheme(), disableElements([...]), enableElements([...]), addHeaderButton({...}), openPanel('comments' | 'search' | 'thumbnails'), closePanel(), getDocument(), refresh(), destroy().
Events
viewer.on('annotationsChanged', (detail, viewer) => { const json = viewer.getDocument().exportAnnotations(); localStorage.setItem('draft', JSON.stringify(json));});// documentLoaded · annotationsChanged · annotationCreated · selectionChanged · toolChanged · pageChanged · layoutChanged · saveKeyboard
V select, H highlight, U underline, N note, T text box, I insert text, P pen, R rectangle, O ellipse, L line, A arrow, E eraser; Ctrl/Cmd + Z, Shift + Z, S, F and O.