Navigate:
~$JSPDF0.1%

jsPDF: Client-side JavaScript PDF generation

Generate PDF documents in-browser with JavaScript APIs.

LIVE RANKINGS • 06:52 AM • STEADY
OVERALL
#133
84
DEVELOPER TOOLS
#26
18
30 DAY RANKING TREND
ovr#133
·Devel#26
STARS
31.0K
FORKS
4.8K
DOWNLOADS
4.5M
7D STARS
+24
7D FORKS
+4
See Repo:
Share:

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.


1

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.

2

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.

3

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");


vv3.0.3

Fixes critical PNG encoding regressions introduced in v3.0.2; upgrade immediately if using PNG images.

  • Upgrade to resolve broken PNG rendering and form object scaling issues from v3.0.2.
  • Patch also fixes division-by-zero crash when calculating word spacing in text layout.
vv3.0.2

Patches a DoS vulnerability in PNG parsing (GHSA-8mvj-3j78-4qmw); removes atob/btoa dependencies and adds fast-png.

  • Upgrade immediately to fix corrupt PNG images causing infinite loops in addImage method.
  • Note that atob and btoa dependencies are removed; fast-png is now required for PNG handling.
vv3.0.1

Patches a ReDoS vulnerability in addImage, html, and addSvgAsImage methods; upgrades canvg to 3.0.11.

  • Update immediately to fix ReDoS in addImage and dependent methods (html, addSvgAsImage).
  • Upgrade optional canvg dependency to 3.0.11 if your project uses it.

See how people are using jsPDF

Loading tweets...


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers