Skip to content

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

ComPDFKit WebViewer UI — Open-Source Documentation ​

The open-source Vue 3 UI layer of the ComPDFKit Web SDK. View, annotate, edit, and sign PDF documents in the browser — fully customizable through instance.UI.


What is this? ​

ComPDFKit WebViewer UI is the open-source UI layer that sits on top of the ComPDFKit Web SDK Core engine (@compdfkit/core). It is built with Vue 3 and Pinia, and ships as a complete, responsive interface for working with PDF documents in the browser.

The interface is made of modular components — headers, ribbon groups, grouped items, buttons, panels, popups and modals. Every part can be hidden, replaced, rearranged or extended at runtime through the instance.UI API, without changing the UI source.

Integrator's page
  └─ webviewer.js / webviewer.global.js  (bootstrap: ComPDFKitViewer(options, element))
       └─ <iframe src="{uiPath}index.html">  (WebViewer UI: Vue 3 + Pinia; uiPath defaults to {path}webviewer/)
            └─ instance = { Core, UI }
                 └─ @compdfkit/core  (DocumentViewer, AnnotationManager, Document …)
                      └─ Web Worker (webviewer/lib/PDFWorker.js) + WASM (ComPDFKit.wasm)

The Core engine (@compdfkit/core with its Web Worker and WASM) is closed source. The UI layer (@compdfkit/webviewer, packages/webviewer in the source repository) documented here is open source: you can read, modify and rebuild it. See Building from source.

Quick start ​

bash
npm install @compdfkit_pdf_sdk/webviewer

Copy the webviewer folder of the package to the static assets of your app, then embed the viewer in your own page:

javascript
import ComPDFKitViewer from "@compdfkit_pdf_sdk/webviewer";

const viewer = document.getElementById('webviewer');

ComPDFKitViewer({
  path: '/',
  initialDoc: 'Your PDF Url',
  licenseKey: 'Input your license here'
}, viewer).then((instance) => {
  const { UI, Core } = instance;

  UI.setLanguage('en');          // Localization
  UI.setTheme('dark');           // Theming
  UI.disableElements(['printButton', 'downloadButton']); // Hide buttons

  Core.documentViewer.addEventListener('documentLoaded', () => {
    console.log('document loaded');
  });
});

See Getting Started.

Guides ​

Fundamentals ​

UI Customization ​

Features ​

  • Tools — Tool modes, setToolMode, registerTool.
  • Annotations — Create, import, export annotations.
  • Forms — Form fields and the form fill navigator.
  • Signatures — Electronic and digital signatures.
  • Stamps — Standard, dynamic, and custom stamps.
  • Content Editor — Text & image content editing, and the page editor.
  • Events — Core events and UI events.

Reference ​

Source layout ​

src/
├── apis/            # Public API surface → instance.UI
├── instance/        # Instance assembly: options, stores, i18n, hotkeys, mounting, cleanup
├── core/            # Thin per-instance wrappers over @compdfkit/core
├── components/      # Vue components (App, modular, panels, popups, modals, overlays, document)
├── stores/          # Pinia stores (viewer, document, settings), one set per instance
├── event-listeners/ # Core events → store updates
├── helpers/         # Utilities and feature flows
├── composables/     # Vue composables
├── constants/       # dataElements, tool names, panel names, events, features
├── i18n/            # Per-instance i18next setup
└── styles/          # Base styles