0.0.19 • Published 4 years ago

nodehtml2img v0.0.19

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

nodehtml2img

A simple node.js module that renders an HTML content and generates an image from it.

how it works

nodehtml2img uses puppeteer to launch an headless browser and render the given html content. Simple like that, nothing more, nothing less.]

install

npm install --save nodehtml2img

usage

using defaults:

import nodehtml2img from "nodehtml2img";

const buffer = nodehtml2img("<h1>Hello, World</h1>");
  • In the example above it will use the following default settings:
const defaultSettings: Settings = {
  transparent: false,
  puppeteerArgs: {},
  encoding: Encoding.BINARY,
  imageFormat: ImageFormat.PNG,
};
  • Using custom settings:
import nodehtml2img, { Encoding, ImageFormat } from "nodehtml2img";

const buffer = nodehtml2img("<h1>Hello, World</h1>", {
  transparent: true,
  puppeteerArgs: {},
  encoding: Encoding.BASE_64,
  imageFormat: ImageFormat.JPEG,
  quality: 95, // from 0 to 100,
  viewport: {
    width: 2000,
    height: 1000,
    deviceScaleFactor: 1,
  },
});
0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

1.0.0

4 years ago