html-to-image 1.1.0
Install from the command line:
Learn more about npm packages
$ npm install @lesjoursfr/html-to-image@1.1.0
Install via package.json:
"@lesjoursfr/html-to-image": "1.1.0"
About this version
Generate PNG/JPEG images from HTML with simple API in Node.js.
This library use electron to generate PNG/JPEG images from HTML.
Install the lib and add it as a dependency :
npm install @lesjoursfr/html-to-image
Then put this in your code:
const { HtmlToImage } = require("@lesjoursfr/html-to-image");
const htmlToImage = new HtmlToImage(target, output, selector, outputType);
htmlToImage
.render()
.then(() => {
console.log("Image Generated Successfully!");
})
.catch((err) => {
console.error("Failed to generate Image because of ", err);
});
-
target
: The URL of the HTML page -
output
: The image file path -
selector
: The CSS selector of the content to capture -
outputType
: The image type ("png" or "jpeg", default to "jpeg")
Details
- html-to-image
-
lesjoursfr
- 5 days ago
- MIT
- 15 dependencies
Assets
- html-to-image-1.1.0.tgz
Download activity
- Total downloads 10
- Last 30 days 10
- Last week 10
- Today 0