Description
Uses Electron to render any webpage (by URL) to a PDF. Works for websites
rendered in the browser with JavaScript.
Installation and Usage
Get with NPM:
npm install --save-exact epdf
npm install --global epdf
Epdf can be used as a Node.js library or from the command line.
Programmatic API
const {render} = require('epdf')
render({url: 'https://my-awesome-website' })
.then(buffer => {
})
.catch(error => {
})
render
takes the same args as the CLI. To see the available settings, run
$(npm bin)/epdf --help
(for local install) or epdf --help
(for global
install).
The value returned by render
can be used as a promise, but is actually a
Future
from the
Posterus library. You can stop it by
calling .deinit()
, which immediately closes the Electron process.
const {render} = require('epdf')
const future = render(settings)
.mapResult(buffer => {})
.mapError(error => {})
future.deinit()
CLI
epdf
$(npm bin)/epdf
epdf --help
epdf --url <some-url>
epdf --url <some-url> --out <some-file>