Skip to content

html-to-image 1.0.4

Install from the command line:
Learn more about npm packages
$ npm install @lesjoursfr/html-to-image@1.0.4
Install via package.json:
"@lesjoursfr/html-to-image": "1.0.4"

About this version

npm version QC Checks

@lesjoursfr/html-to-image

Generate PNG/JPEG images from HTML with simple API in Node.js.

What is this library?

This library use electron to generate PNG/JPEG images from HTML.

Usage

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);
	});

Parameters

  • 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


Assets

  • html-to-image-1.0.4.tgz

Download activity

  • Total downloads 42
  • Last 30 days 0
  • Last week 0
  • Today 0