Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

html2canvas-pro

yorickshan441.5kMIT1.5.11TypeScript support: included

Screenshots with JavaScript. Next generation!

html2canvas, screenshot

readme

html2canvas-pro

Next generation JavaScript screenshots tool.

build status npm version npm downloads

Getting Started | DeepWiki


Why html2canvas-pro?

html2canvas-pro is a fork of niklasvh/html2canvas that includes various fixes and new features. It offers several advantages over the original html2canvas, such as:

  • support color function color() (including relative colors)
  • support color function lab()
  • support color function lch()
  • support color function oklab()
  • support color function oklch()
  • Support object-fit of <img/>
  • Fixed some issues

If you found this helpful, don't forget to leave a star 🌟.

Installation

npm install html2canvas-pro
pnpm / yarn add html2canvas-pro

Usage

import html2canvas from 'html2canvas-pro';

To render an element with html2canvas-pro with some (optional) options, simply call html2canvas(element, options);

html2canvas(document.body).then(function(canvas) {
    document.body.appendChild(canvas);
});

Contribution

If you want to add some features, feel free to submit PR.

If you want to become a maintainer on it, please contact me.

License

MIT.

changelog

1.5.11 (2025-05-12)

Features

  • add the customIsSameOrigin option to support custom same-origin checks (dd9ef5e)

Documentation

  • changelog: fixes (e29d83d)
  • configuration: add examples and explanations for using the customIsSameOrigin option (c404b8f)

Chore

  • missing download info (856f709)
  • reftests: add custom isSameOrigin tests and redirect handling (e371834)

1.5.10 (2025-04-27)

Fixes

  • Remove duplicate enum value (ccaa81d)
  • Resolve duplicate enum value (2cf67f9)

1.5.9 (2025-04-27)

Fixes

  • failed to execute 'addColorStop' on 'CanvasGradient' (f84f057)
  • set font correctly in text input elements (b0203c0)

Documentation

  • readme: add deepwiki (4ffcff9)
  • readme: welcome to become a maintainer (122dafd)

Chore

  • an artifact with this name already exists on the workflow run (d10a0ca)
  • license info (ee445f7)
  • missing download info for actions/upload-artifact@v3 (ef54137)
  • remove html2canvas-proxy (5eafba5)
  • replace request with http (e9d88e4)
  • upgrade appium-xcode & node-simctl (b61e7d1)
  • upgrade glob & rimraf (560c540)

1.5.8 (2024-07-22)

Chore

Fixes

  • -webkit-text-stroke misaligned with the text (48e771a)

1.5.7 (2024-07-18)

Documentation

1.5.6 (2024-07-12)

Features

Refactor

  • swap out the usage of eval for a function constructor (684bb98)

Fixes

Documentation

Chore

1.5.5 (2024-07-09)

Chore

Fixes

  • fix error image use transfrom rotate style (Update stacking-context.ts ) #3153 (2d9ee18)
  • incorrect typings path (46c029f)
  • vertical text alignment fix #3151 (92f6a33)

1.5.4 (2024-07-08)

Performance

  • migrate from Chromeless to Puppeteer (25553e3)
  • remove uglifyjs-webpack-plugin (53beee8)

Documentation

  • features: update supported css properties (95adcd9)
  • readme: leave a star (f4b551b)
  • readme: npm stats (9c26fe8)

Chore

Fixes

  • calculateBackgroundRendering may return width or height less than 1 #2982 (0b1bdae)

1.5.3 (2024-07-04)

Fixes

  • added fix for Firefox issue (c807c3f)

Chore

1.5.2 (2024-07-03)

1.5.1 (2024-07-01)

Fixes

  • operation is insecure on safari (71f7c28)

Features

  • better color() support (2559164)
  • color functions (1c9ece3)
  • complete work on relative from colors in the color() function (ac6e331)
  • work on relative color support (88e6aba)

1.5.0 (2024-05-27)

Features

  • better color() support (2559164)
  • color functions (1c9ece3)
  • complete work on relative from colors in the color() function (ac6e331)
  • work on relative color support (88e6aba)

Fixes

  • color function display-p3 conversion (b9fd943)