PDF Web SDK Documentation

Comprehensive Guide for Developers: UI & SDK Integration, Configuration, and API Reference

PDF Web SDK
    Preparing search index...

    Changelog

    All notable changes to @avanquest/pdf-web-viewer are documented in this file.

    • ui.getFilesProvider(id) returns one of the viewer's own file sources ('onedrive', 'dropbox', 'googledrive', 'netexplorer', 'device', 'recents' or a customProviders id), or null when that source is not enabled. It is the same instance the viewer uses, so a drive connected through it is also connected on the home screen and in "Save as". Use it to build your own save-to-cloud step on isConnected, connect(), accountLabel, listFolder() and saveInto(). Call await provider.ensureInit() before connect(). The IFilesProvider type is now exported.
    • Korean UI language: set languageConfig.code to 'ko' (한국어), or pick it in Settings. LanguageCode now includes 'ko'.
    • Korean and Japanese input methods (IME) work in every text tool: Add text, Edit text, Fill & Sign, form fields and e-sign fields. Syllables and kana are composed inline at the caret and committed in place. A click or a Ctrl/Cmd shortcut during a composition first commits the composed text, then acts.
    • Two bundled fonts, Noto Sans KR (Hangul) and Noto Sans JP (kana and JIS kanji), in Regular and Bold. They are listed with the other bundled fonts, so Korean and Japanese text can be typed when a document has no suitable font. Like the other bundled fonts, they download only when used.
    • Opening a file from your own code with openDocument(file, { origin: { providerId, item } }) now records where it came from. Save then writes back through that provider's saveOver, the same as for a file picked in the viewer's file browser. See "Opening a file from your own code" in the authentication and drives guide.
    • Mobile typing goes through the same path as desktop. Keyboard autocorrect, predictive text, word-by-word composition (Gboard), Korean and Japanese keyboards, and Enter now edit the text correctly.
    • The package is about 12 MB larger unpacked (about 7 MB packed) because of the two new fonts. If you copy the package's public assets to your server, copy the new pwv-fonts/NotoSansKR and pwv-fonts/NotoSansJP folders too.
    • The guides now install the package from its CDN tarball URL for this version. The package is not published to the public npm registry, so npm install @avanquest/pdf-web-viewer does not work outside the Avanquest feed.
    • Convert dialog: the "Content to include" rows no longer shift when switching between JSON and Markdown.
    • The language list shows a neutral icon for Russian instead of an empty space.
    • PDF to JSON and Markdown, for AI and integrations. The SDK adds three methods:

      • IDocumentModel.extractStructuredContent() returns a JSON-serialisable object: document info, the bookmark outline, and the text of each page as headings, paragraphs and list items, each with a page number and a bounding box.
      • convertToJson() returns that object as a .json file.
      • convertToMarkdown() returns a .md file for LLM prompts.

      Pick what to include with include (PdfContentKind: document info, outline, text, headers and footers, layout, annotations, links, form fields, Fill & Sign, attachments), and limit the export with pages. Everything runs locally, with no upload and no server call. See the operations and server-side guides.

    • Convert dialog: JSON and Markdown formats, with a "Content to include" panel where users choose the content kinds.

    • Progress and cancellation for the local converters through the new IConvertOptions (onProgress, signal). It is accepted by the three methods above and as a new optional last argument of convertToText() and convertToImages(), so existing calls are unchanged.

    • Theme tokens for the Convert dialog:

      • --pwv-dialog-convert-card-background-{default,hover,active};
      • the per-format selected colors --pwv-dialog-convert-card-<format>-{icon,border,background}-selected;
      • the settings panel --pwv-dialog-convert-settings-*;
      • --pwv-dialog-convert-excel-option-background-active.
    • Convert dialog redesign:
      • all eight formats in a 4 × 2 grid with new icons;
      • accent colors with good contrast in the dark theme;
      • the dialog can be closed with × and Escape, and closing cancels a conversion in progress;
      • local conversions show their progress on the Convert button;
      • the format cards work with the keyboard (arrow keys, Home/End, Enter/Space).
    • Text, image, JSON and Markdown conversions ask for the owner password only when the document's permissions forbid copying its content. Before, they asked whenever the document had an owner password. The same rule applies to the SDK methods, which throw PdfEditorAccessDeniedError only in that case.
    • Toggle rows in dialogs (Convert options, OCR advanced settings) switch when you click anywhere on the row, not only on the switch.
    • A failed open (wrong password, damaged file) no longer leaves its PDF worker running, so repeated password attempts no longer accumulate background workers.
    • Page content (text, annotations, form fields) that failed to load is loaded again on the next render instead of staying missing.
    • Squiggly underline annotations in existing PDFs are recognized: they are listed and can be selected, moved and copied like highlight, underline and strike-out. Annotations of types the viewer does not support no longer make edits apply to the wrong annotation.
    • Opening an image now reports paywall and timeout errors with their own error types instead of a generic error.
    • Theme tokens for the rulers: --pwv-ruler-background-default, --pwv-ruler-border-default, --pwv-ruler-label-text-default and --pwv-ruler-tick-border-default. By default they follow the toolbar background, divider and secondary text colors, so the rulers match the light and dark themes; override them in themeConfig.customStyles to restyle the rulers alone.
    • Home screen: clicking a recent file whose cloud storage is disconnected now starts that storage's sign-in, the same as + Connect, and opens the file once you are signed in to the same account. Signing in from a recent file keeps the Recents tab open; only + Connect switches to the newly connected storage.
    • Rulers on high-DPI screens (retina, display scaling above 100%): the numbers were multiplied by the pixel ratio (an A4 page read 420 mm instead of 210 mm) and the marks and labels were too small. Rulers are now the same size on every screen and slightly larger than before.
    • Edit handles (resize, rotate and other adorners) and the magnifier were too small on high-DPI screens; they now keep the same on-screen size on every display.
    • Mobile: the viewer no longer grows past the visible viewport, so its bottom controls stay above the mobile browser's address and navigation bars. The basic setup guide now recommends giving a full-page container height: 100dvh.
    • Mobile and tablet: the main menu and the sign-in button stay reachable from the bottom bar, including on the Home screen. The sign-in button now sits in the Tools menu footer.
    • Mobile Tools menu: long item lists scroll while the footer stays visible, and the menu opens above the contextual toolbars.
    • Cloud drive browser: breadcrumbs and action buttons wrap on narrow screens instead of overflowing.
    • Translate toolbar: fits narrow screens. The Translate button, including its copy in the minimized toolbar, stays disabled while the custom page range is empty or invalid.
    • Office documents open directly: docx, dotx, doc, rtf, pptx, potx, ppt, xlsx, xltx, xls, xlt, csv, odt, ott, odp and ods. The viewer converts them to PDF through the Developers API at apiToolsUrl, authorized per apiAuthMode (by default with your license key); files over 100 MB are rejected by the API. The file picker, the cloud-drive listings and pdfWebService.openDocument accept these formats without declaring them in openFormatsConfig.additional or converting them in onOpenFile. A cancellable "Converting … to PDF" progress message is shown, and the converted document carries the 'Create.PDFFromOffice' claim. "Save" never writes the PDF over the original Office file; it saves it as a new document, as "Save as" does. Opening the same Office file again from a cloud drive, the recent files list or a host path while its tab is open switches to that tab.
    • IDocumentModel.historyRevision: a counter bumped on every undo/redo history change. Unlike the history position, it never repeats.
    • IDocumentViewModel.exportFile now resolves a boolean instead of void.
    • IDocumentViewModel.saveDocument, saveDocumentAs and exportFile resolve false when edits were made while the save was running, even though the file was written. Those edits keep the document marked as unsaved, and closing it still asks about them. Overlapping saves now run one after another, so an older save can no longer overwrite a newer one.
    • Opening a plain-text (.txt) file now creates the PDF in a single step, which is faster and more reliable for long, multi-page text. Its progressCallback now reports only 0 and 100. This needs the worker files shipped with this version: re-copy the package's public assets after upgrading.
    • Opening a .txt file now rejects with the typed SDK errors (PdfEditorError and its subclasses, such as PdfEditorPaywallError, plus PdfEditorTimeoutError), as opening a PDF does, instead of a generic Error.
    • The document security / permissions dialog has a new layout.
    • Plain-text (.txt) files in a legacy encoding (for example Windows-1252) now open with the correct characters instead of replacement symbols.
    • The Secure permissions option of the document security dialog no longer shows the "Password security" subtitle.
    • Google Drive in desktop shells (Tauri / Electron). A cross-origin loopback IGoogleDriveConfig.redirectUri switches the connector to a system-browser sign-in (authorization code + PKCE), and IGoogleDriveConfig.clientSecret takes the secret of a Google Desktop app client. The connection survives app restarts. The host relays the callback with the pwv-googledrive-callback window event. The web flow is unchanged.
    • The optional desktop host bridge window.pwvTokenExchange(url, params) may resolve { status, body }. A bare body string is still accepted.
    • Desktop sign-in (OneDrive, Dropbox, NetExplorer, Google Drive): a callback that does not belong to the pending attempt no longer cancels it, and an attempt with no callback (for example after the user closed the browser tab) now fails after 10 minutes so it can be retried.
    • Dropbox, NetExplorer and Google Drive: a cancelled or failed connect attempt no longer clears the account of a session that is still connected.
    • Google Drive: folders with more than 200 items are listed completely, and disconnecting fully forgets the account.
    • Highlight zones (ToolTypes.HIGHLIGHT_ZONE): items shows several groups of regions at once, each with its own label; showLabelOnHover shows a label only while the pointer is over its regions. New styling options: strokeStyle ('solid' | 'dashed'), borderRadius for the regions, labelGap, and borderRadiusTopLeft / borderRadiusTopRight / borderRadiusBottomRight / borderRadiusBottomLeft for the label.
    • Highlight zones have a lighter default look: a solid 1 px border instead of a dashed 3 px one, a 12 px icon instead of 24 px, and square label corners. The label now scales with the zoom level. To keep the previous look, pass strokeStyle: 'dashed', strokeWidth: 3, iconSize: 24 and the four label corner radii set to 4.
    • Translation updates for German, Spanish, French, Italian, Japanese, Portuguese, Russian and Ukrainian, including clearer wording for Crop / Clip and a dedicated wording for the stroke color and thickness controls of line, shape and pencil annotations.
    • The Clear all action of the recent files list uses a larger, easier-to-read font size.
    • Fill & Sign: the Swap signature button is shown when a signature or initials is selected, and the color button's tooltip reads Color instead of Font color for them.
    • The clip toolbar's delete button is labeled Delete clip area instead of Delete.
    • Navigation rail options sidebarCollapsed (start collapsed to icons) and sidebarExpandOnHover (a collapsed rail peeks open under the pointer), both off by default. They are also available in Settings ▸ Appearance, reported by onConfigChange, and can be changed at runtime via pdfWebElement.getSidebarCollapsed() / setSidebarCollapsed() and getSidebarExpandOnHover() / setSidebarExpandOnHover().
    • Recent files: a per-row menu with Open and Remove. Remove takes the entry off the list; the file itself is not touched. A custom IFilesProvider gets the same menu by implementing the new optional forgetItem(item).
    • Every dialog has a close button in its top-right corner (except dialogs that cannot be dismissed with Escape).
    • Tooltips on navigation rail items while the rail is collapsed.
    • Breaking: the navigation rail no longer remembers its collapsed state in the browser's localStorage. To keep it across sessions, persist sidebarCollapsed from onConfigChange and pass it back in the setup options.
    • Settings dialog redesign: exclusive choices use radio buttons, a new Sidebar section, OCR options grouped under Orientation and Script Detection, and an updated About section.
    • ui.showSnackbar() accepts a third options argument (ShowSnackbarOptions): a progress ring (progress, 0–100), a trailing action button (action), and duration: null for a sticky snackbar. It now returns an ISnackbarHandle to update progress / message, close() it, or check isClosed.
    • New 'info' snackbar type.
    • Redesigned snackbars. Upload and save progress now show an info snackbar with a progress ring instead of a percentage in the text; other in-progress messages (e.g. splitting) use the info type too. Snackbars stay centred on the document area when a sidebar is open.
    • Breaking (custom themes): snackbar palette tokens are now per type — each of success, error, warning and info has --pwv-snackbar-<type>-background-default, -border-default, -text-default and -action-background-hover. --pwv-snackbar-text-default, --pwv-snackbar-shadow-default and --pwv-snackbar-shadow-active were removed; move overrides of --pwv-snackbar-text-default to the per-type -text-default tokens.
    • Updated PDF engine.
    • Highlight zone labels can be customized: fontSize, horizontalLabelPadding / verticalLabelPadding, and the icon — showIcon: false for a text-only label, iconSize, iconColor, or a custom icon via iconChar (+ iconFontFamily), iconSvg or iconRenderer.
    • Highlight zones and their label are drawn with rounded corners.
    • Highlight zones: setActiveTool(ToolTypes.HIGHLIGHT_ZONE, { locations, ... }) on the document model highlights page regions (bounding boxes per page) with a configurable fill, dashed border, padding and an optional label above the first region, and scrolls to it. The overlay is not saved to the PDF; setActiveTool(ToolTypes.VIEW) removes it. See "Highlighting Page Regions" in the Document View Element guide.
    • Signing progress, warning dialogs and eSign reason dialogs are now localized in all supported languages.
    • Reset form no longer lets a field that was being edited re-commit its typed text after the reset.
    • Translation toolbar progress labels ("Detecting", "Translating") are localized.
    • pdfWebElement.getRestoreLastViewSettings() / setRestoreLastViewSettings() to read or change the "restore last view" setting at runtime.
    • Blank pages and merged documents are inserted at the correct position from the sidebar page preview (previously off by one at the last page).
    • Documents reopen at the page, zoom and layout they were closed at. Controlled by the new restoreLastViewSettings option (default true) and the matching checkbox in Settings ▸ General; the value is reported by onConfigChange. The position is stored in the recent-files entry (IRecentEntry.viewState, type IDocumentViewState), so it needs recentsConfig to persist across restarts.
    • Updated sidebar page preview styles and the rotate icon.
    • Every document open — including pdfWebService.openDocument() and initialDocument — now goes through the same password prompt (onPasswordRequired or the built-in dialog) and shows the "Failed to open file" snackbar on failure.
    • Breaking: if initialDocument fails to open, PdfEditor() no longer rejects; the viewer stays usable and the error is reported through onError. Move handling from a catch around PdfEditor() to onError.
    • Enter submits the password dialog.
    • Ctrl/Cmd+A in the document no longer selects UI text and closes open dropdowns.
    • Advanced search: "Select all" checkbox for search results, plus layout improvements.
    • pdfWebElement.getOpenDocumentsInNewTab() / setOpenDocumentsInNewTab() and getToolsLayout() / setToolsLayout() to read or change these settings at runtime. onConfigChange now also reports openDocumentsInNewTab.
    • Stale text selection is cleared when closing dialogs and switching document tabs.