Generate PDF invoices or reports in a Node.js backend by writing JavaScript that describes the document layout.
Create a browser-based PDF export feature where users download a styled document without any server-side processing.
Build a PDF with custom fonts, embedded images, and clickable links for a digital product catalog.
Add fillable form fields to a PDF document for e-signatures or data collection workflows.
PDFKit is a JavaScript library for generating PDF files from code, usable in both Node.js server environments and directly in a web browser. Instead of filling out a PDF template by hand, you write JavaScript that describes the document: add a page, set a font, write some text, draw a shape, embed an image, and then export the result as a PDF file. The API is designed to be chained, meaning you can write a sequence of calls one after another without storing intermediate results. The library handles the technical details of the PDF format for you, including font embedding, page layout, and binary encoding. In terms of features, PDFKit can render text with automatic line wrapping and alignment, embed custom fonts in TrueType and OpenType formats, include JPEG and PNG images, draw vector shapes and paths using an interface similar to the HTML canvas element, and add annotations such as links, highlights, and underlines. It also supports fillable form fields (AcroForms), document outlines for navigation, PDF encryption, and access control settings such as restricting printing or copying. For browser use, PDFKit works with build tools like Browserify or webpack, or you can load a prebuilt standalone file without any build step. Output in the browser is streamed to a Blob object, which can be displayed in an iframe or uploaded to a server. Installation for Node.js projects is through npm or yarn with a single command. The documentation and a programming guide are available on the project website, and the guide itself is distributed as a PDF generated by PDFKit, which serves as a live example of the library's output. The library is released under the MIT license.
← foliojs on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.