Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/mkhuda/dom-screenshot
- Owner: mkhuda
- License: mit
- Created: 2022-08-23T06:59:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-26T08:09:22.000Z (about 2 years ago)
- Last Synced: 2023-12-08T06:41:10.974Z (11 months ago)
- Topics: dom, javascript, react, screencapture, screenshot, typescript-definitions, vuejs
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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/)