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
pdf-lib vs the alternatives
Related terms
More in Media and documents
PDFs