mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
13 lines
316 B
JavaScript
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();
|
||
|
}
|