pdf-lib
Create and rewrite PDFs in pure JavaScript: browser, Node, Deno, or React Native.
About
pdf-lib is the JavaScript library for PDF work when you do not want a server or a native dependency involved. Written in TypeScript and compiled to pure JS, it runs in browsers, Node, Deno, and React Native, which makes it the engine behind a lot of client-side PDF tools. It creates documents from scratch, modifies existing ones, draws text, images, and vector graphics, embeds custom fonts, merges and splits, and handles forms end to end: create them, fill them, read them, including checkboxes, radio groups, and dropdowns.
It has around 8,600 stars and a well-written API that developers genuinely like. The honest caveat is momentum: the repository's last push was in mid-2024, and while the library is stable, new PDF features and spec edge cases are not getting attention. Pure-JS processing is also slower than native libraries on large documents, something to keep in mind for batch jobs. For interactive in-browser PDF features, it is still the pragmatic default.
What it can do
- Create PDF documents from scratch in pure JavaScript
- Modify existing PDFs: pages, text, images, vector graphics
- Full form support: create, fill, and read fields of every type
- Merge multiple PDFs or split one into many
- Embed custom fonts and draw pages from other PDFs
- Add, insert, copy, and remove pages
- Works in browsers, Node, Deno, and React Native with zero native deps
- UMD builds available on unpkg and jsDelivr CDNs
Setup
npm install pdf-lib, then import { PDFDocument } from 'pdf-lib'. UMD builds on unpkg and jsDelivr for script-tag use.
Prerequisites
Any JavaScript runtime: browser, Node.js, Deno, or React Native. No native dependencies.
Use cases
Works with
Trust score — 7/10
Scored 7/10 (verified tier, metrics-v1). Evidence: GitHub API confirms 8,661 stars under MIT, but the last push was 2024-07-17; independent 2026 roundups still list it as the standard open-source pick for client-side PDF work, confirming the feature set. Strengths: pure-JS with zero native dependencies, runs everywhere JavaScript runs, clean API, MIT licensed. Docked for: (1) maintenance has effectively stalled since mid-2024; (2) pure-JS processing is slower than native libraries on large files; (3) no independent benchmarks. License: MIT.
★ 8,661 GitHub stars
How the trust score is built
Full methodology →- Adoption · stars/downloads, log-scaled vs peers
- 9.0/10
- Maintenance · recency, releases, issue load
- 5.0/10
- Openness · license + docs
- 10.0/10
- Manual review · sanity read + red-flag check
- 7.0/10
- · Hopding; TypeScript compiled to pure JavaScript, zero native dependencies
- · ~8,661 GitHub stars
- · Create PDFs from scratch; modify existing documents
- · Full form support: create, fill, read fields of every type
- · Merge/split; embed fonts; draw text, images, vector graphics
- · Runs in browsers, Node, Deno, React Native; UMD builds on CDNs
- · Maintenance effectively stalled: last push 2024-07-17
- · Pure-JS processing slower than native libs on large files
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.