Package Exports
- @embedpdf/pdfium
- @embedpdf/pdfium/pdfium.wasm
Readme
@embedpdf/pdfium
PDFium WebAssembly for the web platform. This package provides a powerful JavaScript interface to PDFium, enabling high-quality PDF rendering and manipulation directly in web applications.
Documentation
For complete documentation, examples, and API reference, please visit:
What is PDFium?
PDFium is an open-source PDF rendering engine originally developed by Foxit Software and later released as open source by Google. Written in C++, it's the same engine that powers PDF viewing in Chrome and numerous other applications. This package brings native-quality PDF capabilities to the browser through WebAssembly, without requiring any server-side processing.
Features
- High-fidelity rendering of PDF pages
- Text extraction and search
- Form filling and manipulation
- Annotation support
- Digital signature verification
- PDF modification and creation
Installation
# npm
npm install @embedpdf/pdfium
# pnpm
pnpm add @embedpdf/pdfium
# yarn
yarn add @embedpdf/pdfium
# bun
bun add @embedpdf/pdfiumBasic Usage
import { init, WrappedPdfiumModule } from '@embedpdf/pdfium';
const pdfiumWasm =
'https://cdn.jsdelivr.net/npm/@embedpdf/pdfium/dist/pdfium.wasm';
let pdfiumInstance = null;
async function initializePdfium() {
if (pdfiumInstance) return pdfiumInstance;
const response = await fetch(pdfiumWasm);
const wasmBinary = await response.arrayBuffer();
pdfiumInstance = await init({ wasmBinary });
// Initialize the PDFium extension library
// This is required before performing any PDF operations
pdfiumInstance.PDFiumExt_Init();
return pdfiumInstance;
}
// Usage
async function renderPdf() {
const pdfium = await initializePdfium();
// Use pdfium to load and render PDFs
// See documentation for detailed examples
}Learn More
Check out our comprehensive documentation at embedpdf.com/docs/pdfium for:
- Detailed API reference
- Code examples
- Best practices
- Advanced usage
License
This package is licensed under the MIT License - see the LICENSE file for details.
It also bundles PDFium in WebAssembly form,
which is licensed under the Apache License, Version 2.0.