2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00
books/server/pdf.js

13 lines
316 B
JavaScript
Raw Normal View History

2018-03-29 18:51:56 +00:00
const puppeteer = require('puppeteer');
module.exports = async function (html, filepath) {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent(html);
await page.pdf({
path: filepath,
format: 'A4'
});
await browser.close();
}