1.1.9 • Published 12 months ago

html-screenshots v1.1.9

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

HTML Screenshots

This module generates a preview image from HTML content using Puppeteer. It allows the injection of custom CSS and JavaScript files, saves the generated image as a JPEG, and returns a base64 string representation of the image.

Installation

Install HTML Screenshots with npm:

  npm install html-screenshots

Usage/Examples

import icon from 'html-screenshots';

const basePath: '/path/to/save/image',

const htmlContent = `
  <div>
    <h1>Hello, World!</h1>
    <p>This is a test.</p>
  </div>
`;

const options = {
  cssFiles: ['styles.css'],
  jsFiles: ['script.js']
};

(async () => {
  try {
    await icon(basePath, htmlContent, options);
  } catch (error) {
    console.error('Error generating image:', error.message);
  }
})();
1.1.1

1 year ago

1.1.0

1 year ago

1.1.9

12 months ago

1.1.8

1 year ago

1.0.9

1 year ago

1.1.7

1 year ago

1.0.8

1 year ago

1.1.6

1 year ago

1.0.7

1 year ago

1.1.5

1 year ago

1.0.6

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago