Getting Started
Installing
You can install html2canvas-pro through npm or download a built release.
sh
npm install html2canvas-pro
pnpm add html2canvas-pro
yarn add html2canvas-proUsage
javascript
import html2canvas from 'html2canvas-pro';To render an element with html2canvas-pro with some (optional) options, simply call html2canvas(element, options);
javascript
html2canvas(document.body).then(function(canvas) {
document.body.appendChild(canvas);
});Script tag / CDN
If you don't use a bundler, load the UMD bundle directly — it exposes the global window.html2canvas:
html
<script src="https://cdn.jsdelivr.net/npm/html2canvas-pro/dist/html2canvas-pro.min.js"></script>
<script>
html2canvas(document.body).then((canvas) => document.body.appendChild(canvas));
</script>Other bundles in the npm package: html2canvas-pro.esm.js (ESM), html2canvas-pro.cjs (CommonJS), html2canvas-pro.js (UMD), html2canvas-pro.min.js (UMD, minified).
Interactive Demo
🎨 Demo Area
👋 Hello html2canvas-pro!
This is an HTML element that can be captured
🎯 High AccuracyPixel-perfect rendering
⚡ High PerformanceOptimized rendering engine
🎨 Full FeaturedModern CSS support
✨ Supports modern CSS features like gradients, shadows, rounded corners, transforms, and more
