jsPDF

Client-side JavaScript library for generating PDF documents in the browser or Node.js.

Library
npm
v4.2.1
31,316 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
65 /100 Good
Development Activity 52
Maintenance 24
Community 84
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
73 /100 Good
Architecture 68
Code Quality 78
Innovation 62
Learning Curve 85

jsPDF lets you build PDF documents entirely in JavaScript, without a server round-trip. It covers the core primitives needed for real documents — text with custom fonts and Unicode/TTF embedding, vector shapes, images (JPEG, PNG, WebP, BMP, GIF), tables, and outlines — and runs equally well in the browser or under Node.js, switching automatically between file-system and browser APIs.

Originally MrRio’s project, jsPDF is now co-maintained with the yWorks fork, which added an “advanced” API mode alongside the original “compat” mode. Advanced mode unlocks patterns, transformation matrices, and FormObjects for more sophisticated layouts, while compat mode preserves full backward compatibility with the large ecosystem of existing jsPDF plugins. A companion html method (backed by optional html2canvas/dompurify dependencies) renders arbitrary DOM content straight into a PDF page.

What You Get

  • A jsPDF class with methods for text, lines, shapes, images, and page management, usable identically in the browser and Node.js
  • Support for embedding custom TrueType fonts and Unicode glyphs via a bundled fontconverter tool
  • Built-in decoders for JPEG, PNG, WebP, BMP, and GIF so images can be dropped straight into a document
  • An html() method that renders live DOM content to PDF using the optional html2canvas/dompurify dependencies
  • Dual API modes — a backward-compatible “compat” API and an “advanced” API with patterns, FormObjects, and transformation matrices
  • TypeScript typings, AcroForm support, and plugin points (annotations, outlines, viewer preferences) for extending core functionality

Common Use Cases

  • Generating downloadable invoices, receipts, or reports directly in the browser with no backend PDF service
  • Exporting user-created content (forms, certificates, tickets) to PDF from a web app
  • Producing printable documents from an existing HTML page via the html() renderer
  • Building PDF export features in Node.js server routes without a headless-browser dependency
  • Embedding custom fonts and non-Latin scripts (e.g. Arabic, CJK) into generated documents

Under The Hood

Architecture

The core is a single large class defined in the main source file that composes behavior from a directory of independently loadable feature modules (acroform, add-image, annotations, canvas, cell, context2d, html, SVG, outline, viewer preferences, and more), each extending the core instance through an internal plugin-registration mechanism rather than formal dependency injection. A lightweight PubSub-style event system mediates cross-module hooks such as page-added or font-set events, and rendering state (fonts, page, transformation matrices, output buffer) is threaded through closures captured by the returned API object. The split between “compat” and “advanced” API surfaces is implemented by swapping which method set is exposed at runtime, so changes to the core PDF-writing primitives would ripple through nearly every module, since they all call back into the same instance’s shared internal helpers.

Tech Stack

Written in plain JavaScript (hand-written TypeScript typings are shipped separately rather than compiled from TS source), built with a modern bundler and transpiler to produce ES, UMD, and Node-targeted output plus polyfill bundles for older browsers. Runtime dependencies are kept minimal — a small compression helper and a PNG decoder — while heavier capabilities like HTML rendering, sanitization, SVG rasterization, and legacy-browser polyfills are pulled in only as optional dependencies so consuming bundlers can tree-shake what isn’t used. Tests run against multiple browser targets plus a Node target, and CI runs a browser suite, a multi-version Node matrix, and a separate TypeScript-typings compatibility matrix.

Code Quality

An extensive spec suite covers the majority of feature modules (image handling, canvas/context2d rendering in several variants, encryption, forms, annotations, and more), so this is a genuinely tested codebase rather than an untested one. Error handling favors plain thrown errors for invalid arguments over typed or result-style errors, consistent with the plain-JavaScript (not TypeScript) implementation, and a caught-and-logged path exists for internal event-dispatch failures. Linting and formatting are configured and enforced, and module naming is consistent with the feature each file implements, though the core file itself is very large and mixes many concerns rather than being split further.

What Makes It Unique

The public API is intentionally low-ceremony — construct once, then chain calls to add text, shapes, and images — and this ergonomic default has stayed stable for years, which is a major part of the library’s appeal versus alternatives that require a build pipeline or server round-trip. Its clearest differentiator versus other JavaScript PDF libraries is the dual compat/advanced API design, letting the long-running plugin ecosystem built on the original API keep working unmodified while newer code opts into more powerful primitives (patterns, transformation matrices, form objects) merged in from a parallel fork — a deliberate technical choice to avoid a breaking-change split, rather than a novel PDF-generation technique in itself.

Used by 25 apps in this directory

TypeScript
54%
Other

OpenReplay

Analytics

13,042

Self-hosted session replay and product analytics suite that lets you see exactly what users do on your web app — without sending data to third parties.

View details
91
Repo Health
77
Technical
66
Dependency
Built with
TypeScript 54%
Go 13%
Updated 1 weeks ago
TypeScript
50%
Other

Phase Console

Devops · Security

931

End-to-end encrypted secrets management for engineering teams — from local dev to Kubernetes production.

View details
85
Repo Health
73
Technical
63
Dependency
Built with
TypeScript 50%
Python 48%
Updated 1 weeks ago
Go
40%
Apache 2.0

Rill

Analytics · Data Engineering

2,962

The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.

View details
88
Repo Health
88
Technical
64
Dependency
Built with
Go 40%
TypeScript 38%
Svelte 21%
Updated 6 days ago
Python
88%
Apache 2.0

sirchmunk

AI Development · Data Engineering

1,379

Drop your files and search them instantly — no vector DB, no indexing pipeline, just raw data queried by a self-evolving intelligence layer.

View details
85
Repo Health
70
Technical
72
Dependency
Built with
Python 88%
TypeScript 11%
Updated 1 weeks ago
TypeScript
92%
Other

Suna

AI Agents

20,306

Turn your company into a git repo — one config, one command center, a workforce of AI agents that runs the real work around the clock.

View details
90
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 92%
Updated 6 days ago
HTML
68%
AGPL 3.0

ToolJet

AI Agents · Low Code Platforms · No Code Platforms

41,123

Open-source AI-native platform to build and deploy internal tools, workflows, and AI agents with a visual drag-and-drop builder and 80+ data source integrations.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
HTML 68%
JavaScript 20%
Updated 6 days ago
TypeScript
72%
AGPL 3.0

Worklenz

Collaboration · Product Management · Project Management

3,259

All-in-one open source project management for teams who want full control — plan projects, track tasks, manage resources, and monitor finances without the SaaS lock-in.

View details
87
Repo Health
7
Technical
64
Dependency
Built with
TypeScript 72%
JavaScript 21%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers