PDF Web SDK Documentation

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

PDF Web SDK
    Preparing search index...

    SDK Integration Guide

    This guide explains how to integrate the PDF Web SDK (Headless Mode) into your application.

    The PDF SDK is a headless (UI-less) version of PDF Web SDK that allows you to perform PDF operations programmatically without rendering any user interface. It's perfect for:

    • Server-side PDF processing (Node.js)
    • Custom UI implementations
    • Batch processing and automation
    • Programmatic document manipulation
    • Backend document operations
    npm install https://cdn-developers.avanquest.com/websdk-files/packages/pdf-web-viewer/0.11.8/avanquest-pdf-web-viewer-0.11.8.tgz
    

    The SDK is designed to be lightweight. Unlike the full UI version, you only need to deploy a subset of the assets:

    • pwv-workers: Required. Contains the WebAssembly workers for PDF processing.
    • pwv-fonts: Required. Contains standard fonts for rendering.

    Note: pwv-i18n (translations) and pwv-stamps (stamp images) are only required if you are using the UI component.

    There are two ways to use the SDK:

    When using PdfEditor, the SDK is automatically initialized and available via the sdk field:

    import { PdfEditor } from '@avanquest/pdf-web-viewer';

    /* Initialize with or without container */
    const editor = await PdfEditor({
    license: 'YOUR_LICENSE_KEY',
    basePath: '/assets',
    });

    /* SDK is already initialized - use directly */
    const doc = await editor.sdk.openDocument({ file: pdfFile });
    const fonts = await editor.sdk.listSystemFonts();
    await editor.sdk.registerUserFonts(myFonts);

    Import the SDK directly for standalone usage. You must call PdfSdk.initialize() before any operations:

    import { PdfSdk } from '@avanquest/pdf-web-viewer/sdk';

    /* Required: Initialize before using */
    await PdfSdk.initialize({
    license: 'YOUR_LICENSE_KEY',
    basePath: '/assets',
    });

    /* Now you can perform operations */
    const doc = await PdfSdk.openDocument({ file: pdfFile });
    const fonts = await PdfSdk.listSystemFonts();

    The SDK provides the following operations:

    Method Description
    initialize(options) Initialize the SDK (required when using direct import)
    openDocument(options) Open an existing PDF document
    openBlankDocument(options) Create and open a new blank document
    listSystemFonts() List all available system fonts
    registerUserFonts(fonts) Register custom user fonts