html2canvas

Render live DOM into canvas screenshots entirely in the browser, no server required

Library
npm
v1.4.1
31,927 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
50 /100 Fair
Development Activity 0
Maintenance 20
Community 80
Maturity 60
Momentum 40

Technical Analysis

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

html2canvas is a client-side JavaScript library that takes “screenshots” of webpages or parts of a page by reading the DOM and the CSS styles applied to its elements, then reconstructing that visual state as a <canvas> element. It does not use any actual screen-capture API — instead it walks the DOM tree and manually re-implements rendering for supported CSS properties, which means output is a best-effort visual approximation rather than a pixel-perfect capture.

Because everything happens client-side, html2canvas requires no headless browser, no server-side rendering step, and no native dependencies, making it popular for exporting webpage regions to PNG/JPEG, generating client-side PDFs (combined with libraries like jsPDF), and building “share as image” or “download as image” features directly in the browser.

What You Get

  • A single html2canvas(element, options) function that returns a Promise resolving to a <canvas> element
  • Support for capturing arbitrary DOM subtrees, not just the full page
  • Configurable options for scale, background color, CORS-proxied cross-origin images, and element exclusion
  • TypeScript type definitions bundled with the package
  • A UMD/ESM/CJS build so it can be dropped in via script tag or imported in bundler-based projects

Common Use Cases

  • Adding a “download this as an image” or “share as image” button to a web app
  • Generating client-side PDF exports by rendering a DOM section to canvas and feeding it into jsPDF
  • Capturing visual snapshots of dashboards, invoices, or certificates for export without a backend
  • Building browser-based screenshot tools for user-generated content or reports

Under The Hood

Architecture - html2canvas has no rendering-engine dependency of any kind; instead it recursively clones the target DOM subtree into an internal tree of ElementContainer nodes (see src/dom/), computes each node’s resolved CSS via getComputedStyle, and hands the resulting tree to a CanvasRenderer (src/render/canvas/) that paints borders, backgrounds, text, and images onto a 2D canvas context in DOM paint order — effectively a from-scratch reimplementation of a browser’s box model and paint pipeline rather than a wrapper around a real screenshot API. Tech Stack - Written in TypeScript, bundled with Rollup into UMD/ESM/CJS outputs (dist/html2canvas.js, .esm.js), with zero runtime dependencies; it targets Promise-capable browsers (IE9+ with a polyfill) and ships its own css/ module for parsing CSS values (color, gradients, transforms, box-shadow) since it cannot rely on the browser to expose these programmatically. Code Quality - The src/ tree is organized by concern (dom/, css/, render/) with a tests/reftests visual-regression suite comparing rendered output against reference screenshots across browsers via Karma/Sauce Labs, plus a tests/__tests__ unit suite; however the README itself flags the project as being in an experimental, slow-maintenance state, and commits_per_month activity data shows very low ongoing development. API Design - The public surface is intentionally minimal: a single html2canvas(element, options) call returning a Promise<HTMLCanvasElement>, which keeps the barrier to entry low, though the options object (proxy, scale, ignoreElements, onclone, etc.) requires reading the docs to discover non-obvious cross-origin and iframe-handling behavior.

Used by 23 apps in this directory

Python
53%
AGPL 3.0

LearnHouse

CMS · Learning Management

2,413

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
65
Dependency
Built with
Python 53%
TypeScript 45%
Updated 6 days ago
Clojure
71%
AGPL 3.0

Logseq

Knowledge Management · Note Taking

45,349

A privacy-first, open-source knowledge graph platform combining Markdown, Org-mode, bidirectional linking, and local-first storage for building your second brain.

View details
92
Repo Health
82
Technical
65
Dependency
Built with
Clojure 71%
OCaml 12%
Updated 1 weeks ago
JavaScript
55%
Other

Lokus

Knowledge Management · Note Taking

829

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

View details
75
Repo Health
75
Technical
64
Dependency
Built with
JavaScript 55%
HTML 21%
Rust 12%
Updated 2 months ago
TypeScript
44%
Other

Magic

AI Agents · Automation · Low Code Platforms

5,055

Magic is an enterprise-grade open-source AI agent platform combining a generalist AI agent, workflow engine, IM, and collaborative office system for running an AI-powered digital workforce.

View details
68
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 44%
PHP 32%
Updated 2 months ago
JavaScript
98%
Other

Markdrop

Note Taking

360

Visual drag-and-drop markdown editor with GitHub-specific blocks, cloud sync, and offline PWA support

View details
38
Repo Health
57
Technical
69
Dependency
Built with
JavaScript 98%
Updated 7 months ago
Python
45%
GPL 3.0

MaxKB

AI Development · Knowledge Management

23,022

Build enterprise-grade AI agents with RAG, workflows & multi-modal support

View details
92
Repo Health
68
Technical
66
Dependency
Built with
Python 45%
Vue 37%
TypeScript 17%
Updated 1 weeks ago
TypeScript
89%
GPL 3.0

NoteGen

AI Assistants · Knowledge Management · Note Taking

12,914

Capture anything first, then let AI transform your scattered records into polished, structured Markdown notes with RAG-powered knowledge retrieval.

View details
87
Repo Health
74
Technical
67
Dependency
Built with
TypeScript 89%
Updated 1 weeks ago
Go
75%
Other

Notifuse

Marketing

2,256

Open-source, self-hosted alternative to Mailchimp, Brevo, and Klaviyo — send newsletters and transactional emails without per-email pricing or vendor lock-in.

View details
83
Repo Health
80
Technical
65
Dependency
Built with
Go 75%
TypeScript 22%
Updated 1 weeks ago
TypeScript
99%
Other

Papermark

Digital Signiture · File Storage

9,263

Open-source DocSend alternative with page-by-page analytics, secure data rooms, and custom domains for document sharing.

View details
78
Repo Health
63
Technical
66
Dependency
Built with
TypeScript 99%
Updated 2 months 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