pdfcanvas documentation
pdfcanvas is a client-side PDF editor engine plus a complete editor UI. It has no backend, no license key and no telemetry. These pages cover install, the core API, and the ready-made editor.
Five-line start
npm i pdfcanvas pdfjs-dist pdf-lib @embedpdf/pdfium
import { PdfCanvas } from "pdfcanvas";
const pdf = new PdfCanvas(document.querySelector("#editor")!, {
workerSrc: "/pdfjs/pdf.worker.min.mjs",
pdfiumWasmUrl: "/pdfium/pdfium.wasm",
fontAssetsUrl: "/fonts/",
});
await pdf.load(file);Two entry points
- pdfcanvas — the engine: render, objects, pages, history, export.
- pdfcanvas/editor — the full UI: toolbar, page rail, inspector, signatures, templates, autosave.
Requirements
Any modern browser with WebAssembly. TypeScript types are included. The editor needs a container with an explicit height, for example a flex child with min-height: 0.
Self-hosted assets
The worker, CMaps, standard fonts and the PDFium WebAssembly file must be served from your own origin. The library never loads them from a CDN, which is what keeps documents local.
In this section
- Install pdfcanvasInstall pdfcanvas with npm, copy the PDF.js worker and PDFium WebAssembly files to your public folder, and mount the editor. Vite and Next.js notes.
- Core APIPdfCanvas core API: constructor options, loading and exporting, objects, pages, history, original text overrides, zoom and tools.
- The complete editor UIMount the complete pdfcanvas editor: toolbar, page rail, inspector, signature dialog, templates, IndexedDB autosave, mobile drawers, English and Italian UI.
Frequently asked questions
+Does it work with React, Vue or Svelte?
Yes. The library is plain TypeScript and DOM. Mount it inside a ref or an effect, and call destroy() on unmount.
+Is there a server-side build?
No. It depends on browser APIs. Use a dedicated library for Node pipelines.
+Which PDF engine does it use?
PDF.js for rendering, PDFium compiled to WebAssembly for editing original text, and pdf-lib for writing the output.