jsPDF: Client-side JavaScript PDF generation
Generate PDF documents in-browser with JavaScript APIs.
Learn more about jsPDF
jsPDF is a JavaScript library for creating PDF documents programmatically in client-side environments. It works by providing a JavaScript API that constructs PDF files according to the PDF specification, allowing developers to add content like text, shapes, and images directly in the browser. The library supports multiple module formats including ES2015, UMD, AMD, and Node.js variants, with optional dependencies for advanced features like HTML-to-PDF conversion. Common use cases include generating invoices, reports, and certificates on demand without requiring backend PDF generation services.
Universal Module Support
Ships with ES2015, UMD, AMD, and Node.js variants in a single package. Build tools automatically select the correct format without configuration, ensuring compatibility across different JavaScript environments and bundlers.
Dynamic Dependency Loading
Advanced features like HTML rendering and DOM sanitization load only when invoked. Keeps base bundle size minimal by excluding unused functionality, reducing initial load time for applications that need basic PDF generation.
Flexible Document Configuration
Supports custom page sizes, orientations, and units with fine-grained control over margins, headers, and footers. Generate documents matching specific print requirements or corporate templates programmatically.
import { jsPDF } from "jspdf";
const doc = new jsPDF();
doc.text("Invoice #12345", 10, 10);
doc.text("Total: $99.99", 10, 20);
doc.save("invoice.pdf");This release fixes a critical path traversal/local file inclusion [security vulnerability](https://github.com/parallax/jsPDF/security/advisories/GHSA-
- –This release fixes a critical path traversal/local file inclusion security vulnerability in the jsPDF Node.js build
- –File system access is now restricted by default and can be enabled by either using node's `--permission` flag or the new `jsPDF.allowFsRead` property
This release includes a bunch of bugfixes. Thanks to all contributors!
- –[Snyk] Upgrade @babel/runtime from 7.28.3 to 7.28.4 by @MrRio in
- –fix: cell function now properly accepts align parameter by @vishal-rathod-07 in
- –Remove duplicated function "ga" from WebPDecoder.js by @jvdp in
- –Fix font state management issue #3890 by @srikanth-s2003 in
- –Fix pages property to always return current array reference ( #3898 ) by @Opineppes in
This release fixes regressions with PNG encoding that were introduced in v3.0.2.
- –Fix division by zero when calculating word spacing by @alxndr-pggm in
- –fix scaling of form object bounding boxes by @HackbrettXXX in
- –fix regressions in PNG encoding that were introduced in 3.0.2 by @HackbrettXXX in
- –@alxndr-pggm made their first contribution in
See how people are using jsPDF
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
qr-scanner
Webcam and image QR detection with native API fallback.
json-server
Zero-config REST API server from JSON files.
colima
Lima-based container runtime provisioning for macOS and Linux.
python-dotenv
Parse and load .env files into Python environments.
nvm
Per-user Node.js version manager for switching between installed versions via command line on POSIX-compliant shells.