2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00

Pdf generation based on puppeteer

This commit is contained in:
Faris Ansari 2018-03-30 00:21:56 +05:30
parent 555fcfeda8
commit d7fede965d

12
server/pdf.js Normal file
View File

@ -0,0 +1,12 @@
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();
}