Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mkhuda/dom-screenshot

DOM screenshot by dom-to-image
https://github.com/mkhuda/dom-screenshot

dom javascript react screencapture screenshot typescript-definitions vuejs

Last synced: 4 days ago
JSON representation

DOM screenshot by dom-to-image

Awesome Lists containing this project

README

        

# dom-screenshot
[![Build Status](https://app.travis-ci.com/mkhuda/dom-screenshot.svg?branch=main)](https://app.travis-ci.com/mkhuda/dom-screenshot) [![npm version](https://badge.fury.io/js/%40mkhuda%2Fdom-screenshot.svg)](https://badge.fury.io/js/%40mkhuda%2Fdom-screenshot)

DOM screenshot by dom-to-image forked & modified from [dom-to-image](https://github.com/tsayen/dom-to-image)

## Install
```bash
# 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](https://github.com/tsayen/dom-to-image/issues/78) issue
- Add Typescript support, (.d.ts) battery included.

## TODO (on progress):
- Full rewrite to Typescript
- Adding `chai` test (on progress).

## Usages (React)
```typescript
import DomScreenshot from "@mkhuda/dom-screenshot";
....

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

)
...
```

## 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](https://choosealicense.com/licenses/mit/)