PDFKit is a JavaScript PDF generation library for Node and the browser.
PDFKit addresses the challenge of programmatically creating complex, multi-page PDF documents by providing a chainable API that combines low-level drawing functions with higher-level abstractions. The library uses an HTML5 canvas-like API for vector graphics, supporting path operations, transformations, and gradients. It handles text rendering with line wrapping and soft hyphen recognition, embeds fonts in multiple formats including TrueType and WOFF variants with subsetting capabilities, and supports image embedding for JPEG and PNG files. The tool also provides table generation, annotations with links and highlights, AcroForms for interactive elements, document outlines, and PDF security features including encryption and access privilege controls.
PDFKit suits projects requiring server-side PDF generation in Node environments or client-side generation in browsers. The library works across all three browser integration approaches: Browserify, webpack, or a prebuilt standalone bundle. Developers should note that the tool maintains backward compatibility with both CommonJS and ES module import styles, though new code is encouraged to use named exports for future ESM migration. The project includes accessibility support through marked content, logical structure, and Tagged PDF compliance, making it suitable for documents requiring PDF/UA standards.
The project maintains active development with regular updates addressing both bug fixes and feature additions. The maintainers actively review and merge community contributions, demonstrating responsiveness to external input. Documentation is comprehensive, including a detailed programming guide, interactive browser demo, and multiple examples covering different build tool integrations. The codebase shows consistent attention to backward compatibility while planning for modernization, as evidenced by the deliberate approach to ESM migration.