html2canvas

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

Library
npm
v1.4.1
31,925 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

TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

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
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 5 days ago
Ruby
50%
Other

Chatwoot

Customer Support

37,254

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
69
Dependency
Built with
Ruby 50%
Vue 25%
JavaScript 22%
Updated 5 days ago
TypeScript
98%
AGPL 3.0

Checkmate

Analytics · Devops · Monitoring

10,895

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

View details
90
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
Java
70%
GPL 3.0

DataEase

AI Assistants · Analytics · Data Engineering

24,558

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
65
Dependency
Built with
Java 70%
Vue 29%
Updated 4 days ago
TypeScript
96%

Finance

AI Assistants · Invoicing Finance

903

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

View details
54
Repo Health
62
Technical
70
Dependency
Built with
TypeScript 96%
Updated 3 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
63
Dependency
Built with
TypeScript 99%
Updated 7 months ago
Python
74%
GPL 3.0

Frappe HR

Human Resources

8,831

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

View details
93
Repo Health
70
Technical
78
Dependency
Built with
Python 74%
JavaScript 15%
Updated 5 days ago
TypeScript
87%
Apache 2.0

HyperFrames

AI Design Tools · AI Development

53,695

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
84
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 87%
JavaScript 12%
Updated 4 days ago
PHP
48%
AGPL 3.0

Leantime

Collaboration · Productivity · Project Management

11,672

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

View details
90
Repo Health
68
Technical
65
Dependency
Built with
PHP 48%
CSS 20%
Blade 17%
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