jsPDF

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

Library
npm
v4.2.1
31,296stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
63/100Good
Development Activity48
Maintenance20
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
73/100Good
Architecture68
Code Quality78
Innovation62
Learning Curve85

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 24 apps in this directory

Java
78%
GPL 3.0

DataEase

Analytics · Data Engineering · AI Assistants

24,408

Open-source BI tool with drag-and-drop dashboards, 20+ data source connectors, and AI-powered natural language queries — a self-hosted alternative to Tableau.

View details
93
Repo Health
71
Technical
65
Dependency
Built with
Java78%
Vue22%
Updated 3 days ago
JavaScript
99%
AGPL 3.0

drawDB

Databases

39,363

Design database schemas visually in your browser and export executable SQL for any major database — no account required.

View details
78
Repo Health
70
Technical
73
Dependency
Built with
JavaScript99%
Updated yesterday
TypeScript
96%

Finance

AI Assistants · Invoicing Finance

895

Bloomberg-grade financial data and AI-powered analysis through a conversational chat interface you can self-host.

View details
59
Repo Health
62
Technical
70
Dependency
Built with
TypeScript96%
Updated 3 weeks ago
PHP
48%
AGPL 3.0

Leantime

Productivity · Project Management · Collaboration

11,536

Project management built for ADHD, autism, and dyslexia — simple as Trello, powerful as Jira

View details
88
Repo Health
68
Technical
65
Dependency
Built with
PHP48%
CSS20%
Blade17%
Updated 3 weeks ago
Python
51%
AGPL 3.0

LearnHouse

Learning Management · CMS

2,240

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
90
Repo Health
77
Technical
66
Dependency
Built with
Python51%
TypeScript48%
Updated yesterday
TypeScript
96%
Other

Lightdash

Analytics · Data Engineering

6,119

The open-source Looker alternative that turns your dbt project's metrics and dimensions into governed, self-serve charts and dashboards — no license key required.

View details
93
Repo Health
84
Technical
64
Dependency
Built with
TypeScript96%
Updated yesterday
JavaScript
44%
Other

LimeSurvey

Forms Surveys

3,711

The world's most flexible open-source survey platform with 900+ templates, conditional logic, 80+ languages, and full GDPR compliance for any scale.

View details
85
Repo Health
62
Technical
62
Dependency
Built with
JavaScript44%
PHP34%
CSS12%
Updated 2 days ago
TypeScript
95%
Other

LLM Gateway

AI Development · Devops

1,611

One API endpoint for 25+ LLM providers — route, track costs, enforce compliance, and switch models without changing your code.

View details
85
Repo Health
80
Technical
71
Dependency
Built with
TypeScript95%
Updated yesterday
JavaScript
55%
Other

Lokus

Note Taking · Knowledge Management

788

Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.

View details
77
Repo Health
75
Technical
65
Dependency
Built with
JavaScript55%
HTML21%
Rust12%
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

Search