
pdf-lib
pdf-lib is a free, MIT-licensed JavaScript library for creating and modifying PDF documents.
What pdf-lib is
pdf-lib is a free, MIT-licensed JavaScript library for creating and modifying PDF documents. It can build PDFs, change existing files, and add, insert, remove, or copy pages. Form APIs create, fill, read, and flatten text fields, check boxes, radio groups, dropdowns, and option lists. Developers can draw text, images, existing PDF pages, vector graphics, and SVG paths, while embedding fonts with UTF-8 and UTF-16 support. The library reads and sets document metadata and viewer preferences and can add attachments. It works in browsers, Node, Deno, and React Native; TypeScript is compiled to pure JavaScript without native dependencies. Installation is documented through npm and Yarn, with UMD modules available from unpkg and jsDelivr. Browser, Deno, and JSFiddle examples are provided. It supports web deployment and API access. Boundaries include no encrypted-document support, no plain page-text extraction, no editing page text outside form fields, and no HTML or CSS content embedding.
Good
- Free MIT-licensed library
- Runs across several JavaScript environments
- Creates and fills PDF forms
- Supports images, vectors, fonts, and pages
- No native dependencies
Watch out
- Cannot process encrypted PDFs
- Cannot extract ordinary page text
- Cannot edit non-form page text
- Does not embed HTML or CSS
Who it suits
It suits developers building JavaScript PDF workflows for web, Node, Deno, or React Native environments. It is useful when form handling, page composition, metadata, and attachments are needed without native dependencies.
Verdict
pdf-lib offers broad PDF creation, editing, and form APIs for JavaScript projects. Its text-processing and encryption limits should be checked against the application’s requirements.
Plans and prices
From pdf-lib's own pricing page, checked 11 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| pdf-lib | Free | MIT-licensed JavaScript library · no paid plans listed |
The facts
Each one read from pdf-lib's own pages, with the date it was checked.
What it does
- Distribution
- The project documents installation through npm or Yarn and provides UMD modules through unpkg and jsDelivr CDNs.checked 11 Oct 2026
- Drawing and fonts
- It can draw text, images, PDF pages, vector graphics, and SVG paths, and embed fonts with UTF-8 and UTF-16 character set support.checked 11 Oct 2026
- Forms
- It can create, fill, read, and flatten PDF forms, including text fields, check boxes, radio groups, dropdowns, and option lists.checked 11 Oct 2026
- Help
- The project identifies GitHub Discussions as the best place to ask questions and learn more about pdf-lib.checked 11 Oct 2026
- HTML and CSS limitation
- It does not support using or embedding HTML or CSS when adding content to PDFs.checked 11 Oct 2026
- Integrations
- The documentation includes JSFiddle demos and shows browser use with an iframe and fetch, plus Deno usage.checked 11 Oct 2026
- License
- The GitHub repository identifies the project as MIT licensed.checked 11 Oct 2026
- Metadata and attachments
- It can set and read document metadata and viewer preferences, and add attachments.checked 11 Oct 2026
- PDF editing
- It can create PDFs, modify existing PDFs, and add, insert, remove, or copy pages.checked 11 Oct 2026
- Purpose
- pdf-lib creates and modifies PDF documents in JavaScript environments.checked 11 Oct 2026
- Runtime support
- The project says it works in browsers, Node, Deno, and React Native, and is written in TypeScript compiled to pure JavaScript with no native dependencies.checked 11 Oct 2026
- Security limitation
- pdf-lib does not currently support encrypted documents and warns against using it with them.checked 11 Oct 2026
- Text editing limitation
- It does not provide APIs to remove or edit page text outside of form fields.checked 11 Oct 2026
- Text extraction limitation
- It can extract text from form fields but cannot extract plain page text outside form fields.checked 11 Oct 2026




