Comprehensive Guide for Developers: UI & SDK Integration, Configuration, and API Reference
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.languageConfig.code to 'ko' (한국어), or pick it in Settings. LanguageCode now
includes 'ko'.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.public assets to your server, copy the new pwv-fonts/NotoSansKR and pwv-fonts/NotoSansJP folders
too.npm install @avanquest/pdf-web-viewer does not work outside the Avanquest feed.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};--pwv-dialog-convert-card-<format>-{icon,border,background}-selected;--pwv-dialog-convert-settings-*;--pwv-dialog-convert-excel-option-background-active.PdfEditorAccessDeniedError
only in that case.--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.+ 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.height: 100dvh.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..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..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..txt) files in a legacy encoding (for example Windows-1252) now open with the
correct characters instead of replacement symbols.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.window.pwvTokenExchange(url, params) may resolve
{ status, body }. A bare body string is still accepted.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.strokeStyle: 'dashed', strokeWidth: 3,
iconSize: 24 and the four label corner radii set to 4.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().IFilesProvider gets the same menu by implementing
the new optional forgetItem(item).localStorage. To keep it across sessions, persist sidebarCollapsed from onConfigChange
and pass it back in the setup options.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.'info' snackbar type.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.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.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.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.pdfWebElement.getRestoreLastViewSettings() / setRestoreLastViewSettings() to read or
change the "restore last view" setting at runtime.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.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.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.pdfWebElement.getOpenDocumentsInNewTab() / setOpenDocumentsInNewTab() and
getToolsLayout() / setToolsLayout() to read or change these settings at runtime.
onConfigChange now also reports openDocumentsInNewTab.