pdfly
Version:
Generate a pdf from html.
40 lines (23 loc) • 753 B
Markdown
Generate a pdf from html.
[](https://npmjs.com/package/pdfly)
```sh
npm install pdfly
```
```js
const { promises: fs } = require("fs")
const pdfly = require(".")
const html = await fs.readFile("file.html", "utf8")
const pdf = await pdfly(html)
await fs.writeFile("output.pdf", pdf)
```
Type: `string`
The html to generate the pdf from.
Type: `object`
[](https://github.com/puppeteer/puppeteer/blob/v5.3.1/docs/api.md#pagepdfoptions).