Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.43 KB

README.md

File metadata and controls

53 lines (41 loc) · 1.43 KB

dom-screenshot

Build Status npm version

DOM screenshot by dom-to-image forked & modified from dom-to-image

Install

# YARN
yarn add @mkhuda/dom-screenshot
# NPM
npm install @mkhuda/dom-screenshot

Added & Fix:

  • Change to rollup build
  • Add encodeURIComponent on makeSvgDataUri. Based on this issue
  • Add Typescript support, (.d.ts) battery included.

TODO (on progress):

  • Full rewrite to Typescript
  • Adding chai test (on progress).

Usages (React)

import DomScreenshot from "@mkhuda/dom-screenshot";
....

return(
    <button
        onClick={() => {
          const getElement = document.getElementById("root") as HTMLElement;
          const image = DomScreenshot.toPng(document.body, {});
          image.then((generatedImage) => {
            window.open(generatedImage);
          });
        }}
      >
        Test
    </button>
)
...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT