PDF Web SDK Documentation

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

PDF Web SDK
    Preparing search index...

    Interface ISetupOptions

    Configuration options for initializing the PDF Editor.

    const result = await PdfEditor({
    license: 'your-license-key',
    container: document.getElementById('editor'),
    basePath: '/app', // only if hosted under example.com/app/, omit for the domain root
    onError: (error) => console.error(error),
    });
    interface ISetupOptions {
        apiAuthMode?: ApiAuthMode;
        apiCallbackUrls?: IApiCallbackUrlsConfig;
        apiToolsHeaders?:
            | Record<string, string>
            | (() => Record<string, string> | Promise<Record<string, string>>);
        apiToolsUrl?: string;
        basePath?: string;
        brandingConfig?: IBrandingConfig;
        container?: HTMLElement;
        customProviders?: ICustomFilesProvider[];
        defaultFont?: IDefaultFontConfig;
        defaultPageView?: PdfPageView;
        deviceConfig?: IDeviceConfig;
        disableDefaultNotifications?: boolean;
        dropboxConfig?: IDropboxConfig;
        googleDriveConfig?: IGoogleDriveConfig;
        hideToolsPanel?: boolean;
        initialDocument?: IOpenDocumentOptions;
        languageConfig?: ILanguageConfig;
        layoutConfig?: ILayoutConfig;
        license: string;
        netExplorerConfig?: INetExplorerConfig;
        ocrAdvancedConfig?: IOcrAdvancedConfig;
        onActivity?: IActivityCallback;
        onAddSignature?: (appearanceType: AppearanceType) => void;
        onConfigChange?: (config: IConfigChangeData) => void;
        onContextMenuRequested?: IContextMenuRequestedCallback;
        oneDriveConfig?: IOneDriveConfig;
        onError?: (error: Error) => void;
        onESignFieldEditRequested?: IESignFieldEditRequestedCallback;
        onESignFieldFillRequested?: IESignFieldFillRequestedCallback;
        onESignSignRequested?: IESignSignRequestedCallback;
        onExportFile?: (file: File, claims: readonly string[]) => void;
        onFullscreenRequested?: (fullscreen: boolean) => void;
        onLoadingStateChange?: (isLoading: boolean) => void;
        onOpenFile?: () => Promise<void>;
        onOperationRequested?: IOperationRequestedCallback;
        onPasswordRequired?: IPasswordRequiredCallback;
        onPrint?: (file: File, newTab: boolean, claims: readonly string[]) => void;
        onRemoveSignatureRequested?: IRemoveSignatureRequestedCallback;
        onSnapshotArea?: (blob: Blob, claims: readonly string[]) => void;
        openDocumentsInNewTab?: boolean;
        openFormatsConfig?: IOpenFormatsConfig;
        recentsConfig?: IRecentsConfig;
        restoreLastViewSettings?: boolean;
        sidebarCollapsed?: boolean;
        sidebarExpandOnHover?: boolean;
        themeConfig?: IThemeConfig;
        translateConfig?: ITranslateConfig;
        unitsAndGuides?: IUnitsAndGuidesConfig;
        userFonts?: IUserFontData;
        userInitial?: AppearanceModel[];
        userManagementConfig?: IUserManagementConfig;
        userName?: string;
        userSignature?: AppearanceModel[];
    }
    Index

    Properties

    apiAuthMode?: ApiAuthMode

    How calls to apiToolsUrl are authenticated. Defaults to 'apiKey'.

    apiCallbackUrls?: IApiCallbackUrlsConfig

    Webhooks the API calls when it finishes a job in the background, sent as the X-Callback-Url header. Set them to let long jobs outlive the session: when the API cancels an OCR or Translate run for exceeding its time limit, the viewer re-submits it with this header — which runs the job with no time limit — tells the user the work continues in the background, and the API reports the finished (or failed) document to your endpoint, where your backend mails it out. See IApiCallbackUrlsConfig for why each tool needs its own URL.

    apiToolsHeaders?:
        | Record<string, string>
        | (() => Record<string, string> | Promise<Record<string, string>>)

    Extra HTTP headers merged into every call to apiToolsUrl, applied after the apiAuthMode auth header so these can override it. Only needed by integrators who route these calls through their own infrastructure via apiToolsUrl — e.g. to attach a gateway token or a tenant header.

    Pass a plain object for static headers, or a function for values that can go stale (it is called fresh before every request, and may return a Promise).

    apiToolsUrl?: string

    Base URL for the Avanquest Developers API (translate, OCR, convert). Defaults to 'https://api-developers.avanquest.com'.

    basePath?: string

    URL prefix under which the pwv-* static asset folders (worker, fonts, i18n, cursors, stamps) are served, e.g. '/app' when hosting at example.com/app/pwv-workers, example.com/app/pwv-fonts, etc. Defaults to the domain root ('') - copy the package's public/pwv-* folders there, or set this to match wherever you host them.

    brandingConfig?: IBrandingConfig

    Branding customization (logo, colors, etc.).

    container?: HTMLElement

    DOM element to render the editor into.

    customProviders?: ICustomFilesProvider[]

    Host-owned storage sources ("bring your own cloud"), shown on the empty ("home") screen as extra tabs next to "Recents" and the built-in drives.

    Each entry is always visible and needs no sign-in — the host app already knows the user — and its body is a folder browser with a breadcrumb, driven by ICustomFilesProvider.listFolder. Entries with a missing/duplicate id or non-callable listFolder/getFileAsFile are skipped with a console error. Hide them all with layoutConfig.chooseFile.customProviders: false.

    defaultFont?: IDefaultFontConfig

    Default font configuration.

    defaultPageView?: PdfPageView

    Initial zoom/fit mode applied to every document on open (unless the open call specifies its own). Defaults to PdfPageView.fitWidth on narrow viewports (<1024px) and PdfPageView.fitPage otherwise.

    deviceConfig?: IDeviceConfig

    "This device" as a save target. It works without this — the document leaves through the export (ISetupOptions.onExportFile) unless this config implements the writing. See IDeviceConfig.

    disableDefaultNotifications?: boolean

    Disable default notifications.

    dropboxConfig?: IDropboxConfig

    Dropbox integration. When defined with a clientId (Dropbox app key), the viewer shows a "Dropbox" card on the empty ("home") screen; the end user connects their Dropbox account and the card lists their recent Dropbox PDFs and lets them browse folders. Clicking a file opens it in the clicked pane. See IDropboxConfig.

    googleDriveConfig?: IGoogleDriveConfig

    Google Drive integration. When defined with a clientId, the viewer shows a "Google Drive" card on the empty ("home") screen; the end user connects their Google account and the card lists their recent Drive PDFs and lets them browse folders. Clicking a file opens it in the clicked pane. See IGoogleDriveConfig.

    hideToolsPanel?: boolean

    If true, hides the tools panel on startup.

    initialDocument?: IOpenDocumentOptions

    Initial document to open upon initialization. Note: The file property must be a valid File object.

    languageConfig?: ILanguageConfig

    Language and localization settings.

    layoutConfig?: ILayoutConfig

    Layout customization options.

    license: string

    Your PDF Editor license key (required).

    netExplorerConfig?: INetExplorerConfig

    NetExplorer integration. When defined with a clientId and the customer's platform domain, the viewer shows a "NetExplorer" card on the empty ("home") screen; the end user connects their NetExplorer account and the card lists their files and lets them browse folders. Clicking a file opens it in the clicked pane. See INetExplorerConfig.

    ocrAdvancedConfig?: IOcrAdvancedConfig

    OCR Advanced settings (Settings section and OCR pop-up Settings icon). See IOcrAdvancedConfig.available - hidden by default until you know which OCR module UM granted the signed-in user.

    onActivity?: IActivityCallback

    Callback invoked once per discrete UI activity event — a tool activated, a dialog opened/closed, a header tab switched, a menu action invoked, and so on. Use it to feed the host's analytics. Events are structured (IActivityEvent) and delivered on a microtask; errors thrown by the callback are swallowed and never affect the viewer. When omitted, no tracking work is done at all (zero overhead).

    onAddSignature?: (appearanceType: AppearanceType) => void

    Callback when adding signature or initials.

    onConfigChange?: (config: IConfigChangeData) => void

    Callback when configuration changes.

    onContextMenuRequested?: IContextMenuRequestedCallback

    Callback invoked on right-click within the document, before the built-in context menu opens. Receives the context menu type and the click position relative to the document render element. Return true after showing your own menu to suppress the default one; return false to fall back.

    oneDriveConfig?: IOneDriveConfig

    OneDrive (Microsoft Graph) integration. When defined with a clientId, the viewer shows a "OneDrive" card on the empty ("home") screen; the end user connects their OneDrive account and the card lists their recent OneDrive PDFs and lets them browse folders. Clicking a file opens it in the clicked pane. The library performs the OAuth flow itself using the integrator-provided app credentials. See IOneDriveConfig.

    onError?: (error: Error) => void

    Callback when an error occurs.

    onESignFieldEditRequested?: IESignFieldEditRequestedCallback

    Callback invoked when an already-placed E-Sign field is double-clicked in edit mode. Return true after handling the edit with your own UI to skip the library's default behavior; return false to fall back.

    onESignFieldFillRequested?: IESignFieldFillRequestedCallback

    Callback invoked when an E-Sign field needs a signature-capture modal (Signature / Initials / Certify / DigitalSignature). Return true after applying the value yourself to skip the library's default dialog; return false to fall back. Not invoked for in-place text editors (TextInput, DropDown, Name, Company, Title, Email, Date) or click-toggles (CheckBox, RadioButton).

    onESignSignRequested?: IESignSignRequestedCallback

    Callback invoked when the signer presses the E-Sign toolbar's Sign button. Resolve with the signed File to plug in your own signing service; resolve with null to cancel. Required-field validation runs before this callback fires.

    onExportFile?: (file: File, claims: readonly string[]) => void

    Every file the viewer hands over: the document on Download, and each generated artefact (converted file, extracted images, split or compressed result, attachment, form data, snapshot). One-way on purpose — it delivers a copy and reports nothing back.

    Saving is not this: a save writes to a target and has to say whether it worked, which is deviceConfig.saveOver / saveInto for the machine and the provider itself for a cloud. The one overlap is the device's fallback: with no deviceConfig write methods, saving to "This device" is an export, so it arrives here too.

    claims lists every operation the file's contents went through — the source document's own claims plus the one that produced this artefact, so a compressed export of an OCR'd merge reports all three. Empty for a file with no document behind it (a stored signature bitmap, a snapshot) and for a build whose core reports none.

    onFullscreenRequested?: (fullscreen: boolean) => void

    Callback when the user toggles the viewer's Fullscreen button, with the state they asked for. Set it when the viewer is drawn inside a window it cannot fill by itself — a desktop shell, an embedder with its own chrome — and the viewer stops calling the browser Fullscreen API altogether: put your window into that state, then report what it did through IDocumentViewerWrapperElement.setFullscreenLayout, which is what moves the UI.

    onLoadingStateChange?: (isLoading: boolean) => void

    Callback when loading state changes.

    onOpenFile?: () => Promise<void>

    Callback to handle 'Open File' action.

    onOperationRequested?: IOperationRequestedCallback

    Callback invoked before each document operation. Return false to deny the operation.

    onPasswordRequired?: IPasswordRequiredCallback

    Callback when a password is required for a protected PDF.

    onPrint?: (file: File, newTab: boolean, claims: readonly string[]) => void

    Callback when printing. claims lists the operations the printed contents went through, the same list ISetupOptions.onExportFile receives — a print hands a copy of the document over too.

    onRemoveSignatureRequested?: IRemoveSignatureRequestedCallback

    Callback invoked when the user requests to remove all signatures. Override to provide a custom confirmation dialog.

    onSnapshotArea?: (blob: Blob, claims: readonly string[]) => void

    Callback when a snapshot area is captured.

    openDocumentsInNewTab?: boolean

    If true (default), each opened document gets its own tab. If false, the new document replaces the current view.

    openFormatsConfig?: IOpenFormatsConfig

    Extra file formats the open UI should offer, on top of the ones the viewer reads itself. Only widens what the picker and the cloud listings let the user choose — opening such a file is yours to handle, via onOpenFile. See IOpenFormatsConfig for the built-in list and what happens to a declared format that is not converted.

    recentsConfig?: IRecentsConfig

    Storage for the recent-documents history. The viewer keeps the history itself and shows it on the empty ("home") screen; this only makes it outlive a page reload. See IRecentsConfig.

    restoreLastViewSettings?: boolean

    If true (default), reopening a document returns it to the page, zoom and layout it was last closed at — see IRecentEntry.viewState, which is where that is stored, and needs IRecentsConfig to survive a restart. If false, every document opens at the top. The reader can change this in Settings; persist the value from IConfigChangeData.restoreLastViewSettings and pass it back here to restore it.

    sidebarCollapsed?: boolean

    Start the LayoutVariant.NAVIGATION_SIDEBAR rail collapsed to icons. Default false. The reader can change this from the rail's collapse button or in Settings > Appearance; persist the value from IConfigChangeData.sidebarCollapsed and pass it back here to restore it. Ignored by layouts that render no rail.

    sidebarExpandOnHover?: boolean

    If true, a collapsed rail peeks open while the pointer is over it, drawn over the document rather than pushing it. Default false — a collapsed rail stays collapsed until the reader expands it. The reader can change this in Settings > Appearance; persist the value from IConfigChangeData.sidebarExpandOnHover and pass it back here to restore it.

    themeConfig?: IThemeConfig

    Theme configuration (light/dark mode, colors).

    translateConfig?: ITranslateConfig

    Translate workflow configuration.

    unitsAndGuides?: IUnitsAndGuidesConfig

    Units and guides (ruler, grid) configuration.

    userFonts?: IUserFontData

    Custom fonts to make available in the editor.

    userInitial?: AppearanceModel[]

    Pre-defined initials for Fill & sign.

    userManagementConfig?: IUserManagementConfig

    User management configuration (login, logout, account URLs and user info).

    userName?: string

    Display name of the current user for annotations.

    userSignature?: AppearanceModel[]

    Pre-defined signatures for Fill & sign.