Introduction
A modern PDF library for TypeScript - parsing, generation, forms, encryption, and digital signatures.
LibPDF
A modern PDF library for TypeScript focused on both parsing and generation.
Beta Software
LibPDF is under active development. We don't have plans to introduce breaking changes, but we're still experimenting to make sure this becomes the best PDF library for TypeScript. APIs may evolve as we refine the developer experience.
Why?
The JavaScript ecosystem's PDF landscape is fragmented:
- pdf.js (Mozilla) - excellent parsing/rendering, but focused on browser viewing, not manipulation
- pdf-lib - great for generation and basic manipulation, but parsing is limited
- pdfkit - generation only, no parsing
LibPDF fills that gap with a single, comprehensive library that handles parsing, generation, forms, encryption, and digital signatures.
Quick Example
import { PDF } from "@libpdf/core";
const pdf = await PDF.load(bytes);
console.log(`${pdf.getPageCount()} pages`);
const page = await pdf.getPage(0);
const text = await page.extractText();Features
| Feature | Status | Notes |
|---|---|---|
| PDF 1.0–1.7 | Full | Read and write |
| PDF 2.0 | Read | Write planned |
| Encrypted PDFs | Full | RC4, AES-128, AES-256 |
| AcroForms | Full | Read, fill, flatten |
| Digital Signatures | Sign | PAdES B-B through B-LTA |
| Text Extraction | Full | With positions and search |
| Font Embedding | Full | TTF/OTF with subsetting |
| Incremental Saves | Full | Preserves existing signatures |
Installation
npm install @libpdf/coreWorks with Node.js 18+, Bun, and browsers. No polyfills required.
What's Next?
Installation
Setup for Node.js, Bun, and browsers
Parse a PDF
Load, inspect, and extract text from existing PDFs
Create a PDF
Generate PDFs from scratch with text, images, and shapes
Known Limitations
- Predefined CJK CMaps: Only Identity-H and Identity-V CMaps are supported. Legacy CJK PDFs using predefined CMaps without ToUnicode maps may not extract text correctly.
- Signature Verification: Signing works; verification is not yet implemented.
- XFA Forms: Data extraction only; XFA rendering is not supported.
- Annotations: Read/write/flatten support is planned but not yet implemented.
