Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreasarvidsson/openwebproject-gethtmlasimage
Download HTML as image
https://github.com/andreasarvidsson/openwebproject-gethtmlasimage
Last synced: about 1 month ago
JSON representation
Download HTML as image
- Host: GitHub
- URL: https://github.com/andreasarvidsson/openwebproject-gethtmlasimage
- Owner: AndreasArvidsson
- License: mit
- Created: 2020-08-06T12:43:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-06T12:51:41.000Z (over 4 years ago)
- Last Synced: 2024-09-27T07:46:57.717Z (about 2 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenWebProject Get HTML as image
Download HTML as image## Installation
`npm install owp.get-html-as-image --save`## Usage
```js
import downloadImage from "owp.get-html-as-image";downloadImage(container: dom|image, filename: string)
```* container: Dom element or string of element ID.
* filename: File name to store the file as.
- Optional
- Defaults to `"html.png"`
- Is specified without an extension/ending `.png` will be used### Examples
```js
//Download image from container with ID "myDiv" and save as "image.png"
downloadImage("myDiv", "image.png")//Download image from container with ID "myDiv" and save as "image.png"
downloadImage(document.getElementById("myDiv"), "image.png")//Download image with default name => html.png
downloadImage("myDiv")//Download image with default file extension => image.png
downloadImage("myDiv", "image")//Download image with different file names and extensions
downloadImage("myDiv", "image.jpg")
downloadImage("myDiv", "img.jpeg")
downloadImage("myDiv", "html.bmp")
```