2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/server/pdf.js
2018-03-30 00:21:56 +05:30

13 lines
316 B
JavaScript

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();
}