ComPDFKit Web SDK
    Preparing search index...

    Interface WebViewerOptions

    Options of a WebViewer call.

    interface WebViewerOptions {
        annotationUser?: string;
        autoJumpNextSign?: boolean;
        compat?: CompatOptions;
        config?: string;
        cspNonce?: string;
        css?: string;
        custom?: string;
        customFontURL?: string | null;
        defaultLanguage?: string;
        disabledElements?: string[];
        disableI18n?: boolean;
        disableLogs?: boolean;
        disableMultiViewerComparison?: boolean;
        disableObjectURLBlobs?: boolean;
        documentId?: string;
        enableAnnotations?: boolean;
        enableFilePicker?: boolean;
        enableMeasurement?: boolean;
        enableRedaction?: boolean;
        extension?: string;
        filename?: string;
        initialDoc?: DocumentSource | DocumentSource[];
        instanceId?: string;
        isAdminUser?: boolean;
        isReadOnly?: boolean;
        keepWorkerOnDispose?: boolean;
        licenseKey?: string;
        mount?: MountMode;
        path: string;
        preloadWorker?: boolean | "pdf" | "all";
        renderWorkerCount?: number;
        selectAnnotationOnCreation?: boolean;
        serverUrl?: string;
        serverUrlHeaders?: Record<string, string>;
        showToolbarControl?: boolean;
        theme?: "light" | "dark";
        uiConfig?: string;
        uiPath?: string;
        webFontURL?: string;
        workerPath?: string;
        [key: string]: unknown;
    }

    Indexable

    • [key: string]: unknown
    Index
    annotationUser?: string

    Author name written on the annotations created by this user.

    autoJumpNextSign?: boolean

    Reserved; currently has no effect.

    compat?: CompatOptions

    Settings of the 2.x compatibility layer: silent turns off console notices, onDeprecated hands them to the integrator; by default each call to an old API logs a console notice.

    config?: string

    URL of a config script run inside the viewer iframe before the UI is mounted; iframe mode only. A relative URL is resolved against the UI page (uiPath). With a cross-origin UI this script is the place for code and callbacks, since WebViewer() then resolves undefined and function options are not passed into the iframe.

    cspNonce?: string

    Nonce added to the style elements the viewer creates, for pages with a strict Content Security Policy.

    css?: string

    URL of a stylesheet added to the viewer, for custom styles. A relative URL is resolved against the UI page (uiPath).

    custom?: string

    Custom string passed to the viewer; read it with UI.getCustomData().

    customFontURL?: string | null

    Fallback font; defaults to ${workerPath}DroidSansFallbackFull.ttf; null turns it off.

    defaultLanguage?: string

    Initial UI language code, for example 'en' or 'zh-CN'; a language the user picked earlier takes precedence.

    disabledElements?: string[]

    dataElement names of UI elements to disable (hide) from the start, as with UI.disableElements.

    disableI18n?: boolean

    Reserved; currently has no effect.

    disableLogs?: boolean

    Turns off the SDK's console logs.

    disableMultiViewerComparison?: boolean

    Hides the document comparison feature of multi-viewer mode.

    disableObjectURLBlobs?: boolean

    Creates workers from the worker script URL instead of a blob: URL, for pages whose Content Security Policy forbids blob: workers.

    documentId?: string

    Identifier of initialDoc, kept with the document.

    enableAnnotations?: boolean

    Shows annotations; true by default. With false, annotations are hidden in every viewer of the instance.

    enableFilePicker?: boolean

    Reserved; currently has no effect.

    enableMeasurement?: boolean

    Shows the measurement tools; with false they are hidden.

    enableRedaction?: boolean

    Enables redaction; true by default. With false, redaction is turned off and its UI hidden.

    extension?: string

    File extension of initialDoc, for sources without one (such as a URL without a file name).

    filename?: string

    File name of initialDoc; used when it cannot be taken from the source (for example a Blob) and when downloading.

    The document opened after the viewer loads: a URL, File, Blob, ArrayBuffer, Uint8Array or base64 data. With an array, only the first item is opened.

    instanceId?: string

    Prefix of persisted keys; defaults to element.id, then 'default'.

    isAdminUser?: boolean

    Whether the current user is an admin, who can change the annotations of other users; defaults to true.

    isReadOnly?: boolean

    Opens documents read-only: annotations and form fields cannot be changed.

    keepWorkerOnDispose?: boolean

    Defaults to false: Core.resetWorker() is called when the last instance of this realm is destroyed; true keeps the worker.

    licenseKey?: string

    The license key. Without it the viewer opens but reports a missing license.

    mount?: MountMode

    How the UI is mounted. Only 'iframe' (the default) is supported in this version; other values are rejected with INVALID_OPTIONS.

    path: string

    Required: URL of the folder that contains the webviewer/ UI folder (absolute, or relative to the host page).

    preloadWorker?: boolean | "pdf" | "all"

    Defaults to true; 'pdf' / 'all' are treated as true.

    renderWorkerCount?: number

    Number of render workers.

    selectAnnotationOnCreation?: boolean

    Selects each annotation right after it is created.

    serverUrl?: string

    URL that UI.saveAnnotations posts the exported XFDF to.

    serverUrlHeaders?: Record<string, string>

    HTTP headers sent with the UI.saveAnnotations request.

    showToolbarControl?: boolean

    Shows the top header; with false it is hidden.

    theme?: "light" | "dark"

    Initial color theme: 'light' or 'dark'.

    uiConfig?: string

    URL of a modular UI JSON file applied with UI.importModularComponents when the viewer starts.

    uiPath?: string

    Defaults to ${path}webviewer/ (the layout of the SDK package).

    webFontURL?: string

    Font group directory (its fonts.json lists the fonts). The core loads the whole group and the font dropdown reads the same list.

    workerPath?: string

    Core assets directory (PDFWorker.js and so on); defaults to ${uiPath}lib/.