html-to-image-puppeteer
Node.js library to convert HTML to image using Puppeteer.
Table of Contents
Installation
To install the dependencies, run:
npm install
Usage
Here is an example of how to use the library:
const { convertHtmlToImage } = require('html-to-image-puppeteer');
const htmlContent = '<html><body><h1>Hello, World!</h1></body></html>';
const outputPath = 'output.png';
convertHtmlToImage(htmlContent, outputPath)
.then(() => {
console.log('Image created successfully!');
})
.catch((error) => {
console.error('Error creating image:', error);
});
Scripts
test: Run the tests using Jest.
lint: Lint the code using ESLint.
build: Compile the TypeScript code to JavaScript.
To run a script, use:
For example, to run the tests:
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Contributors
Subodha Sahu (subodha.sahu-graymatter@monotype.com)
License
This project is licensed under the MIT License. See the LICENSE file for details.