1.1.9 • Published 9 months ago

html-screenshots v1.1.9

Weekly downloads
-
License
MIT
Repository
-
Last release
9 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

10 months ago

1.1.0

10 months ago

1.1.9

9 months ago

1.1.8

10 months ago

1.0.9

10 months ago

1.1.7

10 months ago

1.0.8

10 months ago

1.1.6

10 months ago

1.0.7

10 months ago

1.1.5

10 months ago

1.0.6

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago