Why html2canvas-pro
html2canvas-pro has several advantages over the original html2canvas, including:
Color Functions
- support color function
color()(including relative colors) - support color function
lab() - support color function
lch() - support color function
oklab() - support color function
oklch()
Layout & Rendering
clip-pathsupport —inset(),rect(),xywh(),circle(),ellipse(),polygon(),path()mask-imagesupport — alpha masks with position / size / repeat, composited on a dedicated surfacebackdrop-filter— frosted-glass captures with the same filter-chain support as the filter surface path (see Backdrop-filter support)background-clip: text— gradient text rendered on a device-pixel surface, sharp at anydevicePixelRatio- Complete gradient family —
linear-gradient(),radial-gradient(),conic-gradient()and allrepeating-*variants object-fitsupport for<img/>writing-modesupport — horizontal-tb, vertical-rl, vertical-lr- Image smoothing control — CSS
image-renderingproperty +imageSmoothing/imageSmoothingQualityoptions - Faithful box-shadows — inset shadows, blur/border-radius scaling, and shadows that follow transformed ancestors (v2.4.5)
- Filter compositing — eligible layers render full standard filter chains on a dedicated surface with correct layer
opacity; see filter support notes - Counters & quotes —
counter-increment/counter-resetand thequotesproperty forcontent
DOM Coverage
- Shadow DOM & Web Components — slot assignment, shadow-root cloning, and automatic iframe placement inside the shadow root
- Custom elements — shadow roots and attributes are preserved in clones
- Fieldset & legend — legend bounds are centered like the browser does
- CJK text — correct alphabetic baseline with
letter-spacing, andwhite-spaceaware textarea wrapping
Developer Experience
- Security validation — Built-in
ValidatorAPI for XSS/SSRF protection - Performance monitoring — Built-in
PerformanceMonitorAPI for metrics collection - Error, progress & cancellation hooks —
onErrorcallback,onProgresspipeline milestones andAbortSignalcancellation - TypeScript — First-class type definitions included
- Vitest — Modern test runner for faster testing
Performance
- Deferred CSS parsing with LRU caches
- Batched, parallel image preloading
- Native canvas filter fast path with a verified SVG fallback
Bug Fixes
Fixed some issues from the original project.
