Now in Beta

The PDF library
TypeScript deserves

Parse, modify, sign, and generate PDFs with a modern TypeScript API.The only library with incremental saves that preserve digital signatures.

TypeScript native
Minimal dependencies
Node, Bun & Browser
$npm install @libpdf/core
$bun add @libpdf/core

Sponsored by

Documenso

Capabilities

Everything you need for PDFs

Incremental Updates

Append changes without rewriting the entire file. Preserves existing digital signatures.

Digital Signatures

PAdES B-B through B-LTA with long-term validation. OCSP and CRL embedding.

Encryption

AES-256 and RC4 password protection. Decrypt on load, encrypt on save.

Form Filling

Fill and flatten text fields, checkboxes, radio buttons, and dropdowns.

Text Extraction

Extract text content from pages with position and formatting information.

Merge & Split

Combine multiple documents, extract page ranges, and embed pages as XObjects.

Attachments

Embed and extract file attachments with full EmbeddedFiles support.

Content Drawing

Draw text and images on pages. TrueType font embedding with automatic subsetting.

Developer Experience

An API that makes sense

No wrestling with low-level PDF internals. Load documents, manipulate them with intuitive methods, and save. The complexity is handled for you.

  • Familiar API patterns from pdf-lib
  • Robust malformed PDF parsing from pdf.js
  • Incremental saves that preserve signatures
sign-document.ts
import { PDF, P12Signer } from '@libpdf/core';

// Load an encrypted PDF
const pdf = await PDF.load(bytes, { password: 'secret' });

// Fill form fields
const form = pdf.getForm();
form.getTextField('name').setText('Jane Doe');
form.getCheckBox('agree').check();

// Sign with a certificate (returns the signed bytes)
const signer = await P12Signer.create(p12Bytes, 'password');
const { bytes: signed } = await pdf.sign({ signer });

Comparison

The best of both worlds

pdf.js excels at parsing. pdf-lib excels at generation. LibPDF does both, plus incremental updates and digital signatures.

Supported
Partial
Planned
Not supported
LibPDFpdf-libpdf.js
Incremental saves
Digital signatures
Encrypted PDFs
Parse existing PDFs
Modify existing PDFs
Generate new PDFs
Text extraction
Form filling
Merge documents
Render to image
TypeScript-first

Add PDF support in minutes

Follow the quickstart guide and ship your first PDF feature today.