html-png-stream
Convert a stream of HTML documents into PNG Buffer Objects
Installation
This module is installed via npm:
$ npm install html-png-stream
Example Usage
Render some HTML into a PNG Buffer Object
var htmlPngStream = ;var ps = ;var rs = stream;rs {};rs;ps;// render some HTMLrs;
API
htmlPngStream([options])
The constructor is passed an options object:
width
,height
- the width and height of the browser. NB: This is not the maximum dimensions of each screenshot. So if the rendered page is higher thanheight
the screenshot returned will be the full rendered height of the page.browser
- The browser to use for rendering. By default this isphantomjs
and this module bundles together a static binary of phantomjs with phantomjs-bin. If you have Google Chrome installed andchromedriver
is in yourPATH
, then you can render with Chrome.
write(chunk, [enc], [cb])
You can pipe a HTML fragment or a URL to this stream and it will be rendered.