Media and documents · Library

pdf-lib

A JavaScript library for creating PDFs and editing existing ones: filling in forms, adding or copying pages, stamping text and images, and merging or splitting files.

PDFs · Open source · updated

How it works

pdf-lib is written in TypeScript with no native parts, so it runs in browsers, Node, Deno and React Native. You work page by page: add a page of a given size, draw text, lines, shapes and embedded PNG or JPEG images at x and y coordinates, embed custom fonts, fill and flatten form fields, copy pages between documents, and set metadata.

There is no layout engine: beyond basic line wrapping you place everything yourself, and long text does not flow onto new pages. It cannot display a PDF either (PDF.js does that). It suits templates designed elsewhere, such as stamping a name onto a certificate or filling in an official form. Development of the original package has slowed, and the actively maintained fork @cantoo/pdf-lib adds encryption, full SVG drawing and other fixes.

pdf-lib pricing

Open source

Free (MIT).

Approximate, checked September 2026.What the other tools cost

pdf-lib vs the alternatives

More in Media and documents

PDFs

All 14 Media and documents terms

Crafted in the dark. Shipped to the world.

Tell us what you are building. You get a private project space with a proposal and a line-by-line quote within a day.