html2canvas

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

Library
npm
v1.4.1
31,915stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
50/100Fair
Development Activity0
Maintenance20
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
65/100Good
Architecture68
Code Quality62
Innovation60
Learning Curve70

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

TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
Ruby
49%
Other

Chatwoot

Customer Support

35,974

Open-source omnichannel customer support platform with AI-powered agents, live chat, and self-hosting — a full Intercom and Zendesk alternative.

View details
95
Repo Health
78
Technical
72
Dependency
Built with
Ruby49%
Vue26%
JavaScript22%
Updated today
TypeScript
97%
AGPL 3.0

Checkmate

Devops · Analytics · Monitoring

10,556

Self-hosted uptime and infrastructure monitoring with multi-protocol checks, global geo-coverage, and beautiful real-time dashboards.

View details
91
Repo Health
82
Technical
69
Dependency
Built with
TypeScript97%
Updated yesterday
Java
78%
GPL 3.0

DataEase

Analytics · Data Engineering · AI Assistants

24,346

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
94
Repo Health
71
Technical
66
Dependency
Built with
Java78%
Vue22%
Updated today
TypeScript
96%

Finance

AI Assistants · Invoicing Finance

890

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

View details
62
Repo Health
62
Technical
71
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
TypeScript
99%
AGPL 3.0

fountain-ink

Blogging

64

A self-hostable, decentralized blogging platform built on Lens Protocol — own your content, audience, and distribution forever.

View details
26
Repo Health
66
Technical
69
Dependency
Built with
TypeScript99%
Updated 6 months ago
Python
73%
GPL 3.0

Frappe HR

Human Resources

8,594

Complete open-source HRMS for employee lifecycle, attendance, payroll, and performance — built on Frappe Framework with a mobile PWA.

View details
92
Repo Health
70
Technical
78
Dependency
Built with
Python73%
JavaScript15%
Updated yesterday
TypeScript
89%
Apache 2.0

HyperFrames

AI Development · AI Design Tools

41,625

Turn plain HTML and CSS into deterministic, pixel-perfect MP4 videos — authored by humans or AI agents, rendered by headless Chrome and FFmpeg.

View details
82
Repo Health
83
Technical
65
Dependency
Built with
TypeScript89%
Updated today
PHP
48%
AGPL 3.0

Leantime

Productivity · Project Management · Collaboration

11,391

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

View details
90
Repo Health
68
Technical
67
Dependency
Built with
PHP48%
CSS20%
Blade17%
Updated 4 days 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