You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A modern PDF library for TypeScript — parsing and generation.
3
+
A modern PDF library for TypeScript. Parse, modify, and generate PDFs with a clean, intuitive API.
4
4
5
-
## Why?
5
+
> **Beta Software**: LibPDF is under active development. APIs may change between minor versions. Not yet recommended for production use.
6
6
7
-
The JavaScript ecosystem's PDF landscape is fragmented:
8
-
-**pdf.js** (Mozilla) - excellent parsing/rendering, but focused on browser viewing, not manipulation
9
-
-**pdf-lib** - great for generation and basic manipulation, but parsing is limited
10
-
-**pdfkit** - generation only, no parsing
7
+
## Why LibPDF?
11
8
12
-
There's no single, comprehensive library that handles both robust parsing *and* generation with a clean, modern API.
9
+
LibPDF was born from frustration. At [Documenso](https://documenso.com), we found ourselves wrestling with the JavaScript PDF ecosystem:
13
10
14
-
**@libpdf/core** aims to fill that gap.
11
+
-**PDF.js** is excellent for rendering, but it's read-only
12
+
-**pdf-lib** has a great API, but chokes on slightly malformed documents
13
+
-**pdfkit** only generates, no parsing at all
15
14
16
-
## Goals
15
+
We kept adding workarounds. A patch here for a malformed xref table. A hack there for an encrypted document. Eventually, we decided to build what we actually needed:
17
16
18
-
-**Full PDF parsing** - extract text, images, metadata, structure
19
-
-**Full PDF generation** - create documents from scratch
20
-
-**PDF manipulation** - modify existing documents
21
-
-**Modern TypeScript** - strong typing, tree-shakeable, no legacy baggage
22
-
-**Runtime flexible** - Node.js, Bun, and browsers
17
+
-**Lenient like PDFBox and PDF.js**: opens documents other libraries reject
18
+
-**Intuitive like pdf-lib**: clean, TypeScript-first API
19
+
-**Complete**: encryption, digital signatures, incremental saves, form filling
23
20
24
-
## Known Limitations
21
+
## Features
25
22
26
-
-**Predefined CJK CMaps**: Only Identity-H and Identity-V CMaps are supported. Legacy CJK PDFs using predefined CMaps (UniGB-UCS2-H, UniJIS-UCS2-H, etc.) without ToUnicode maps may not extract text correctly. Modern PDFs include ToUnicode maps which work correctly.
23
+
| Feature | Status | Notes |
24
+
|---------|--------|-------|
25
+
| Parse any PDF | Yes | Graceful fallback for malformed documents |
26
+
| Create PDFs | Yes | From scratch or modify existing |
Real-world PDFs are messy. Export a document through three different tools and you'll get three slightly different interpretations of the spec. LibPDF prioritizes *opening your document* over strict compliance. When standard parsing fails, we fall back to brute-force recovery, scanning the entire file to rebuild the structure.
141
+
142
+
### Two API layers
143
+
144
+
-**High-level**: `PDF`, `PDFPage`, `PDFForm` for common tasks
145
+
-**Low-level**: `PdfDict`, `PdfArray`, `PdfStream` for full control
146
+
147
+
## Documentation
148
+
149
+
Full documentation at [libpdf.dev](https://libpdf.dev)
150
+
151
+
## Sponsors
152
+
153
+
LibPDF is developed by [Documenso](https://documenso.com), the open-source DocuSign alternative.
0 commit comments