| Conditions | 1 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /* eslint-disable no-console */ |
||
| 9 | async function exportResumeAsPdf() { |
||
| 10 | console.log('Starting PDF export.', '\n'); |
||
|
|
|||
| 11 | const browser = await puppeteer.launch({ headless: true }); |
||
| 12 | const page = await browser.newPage(); |
||
| 13 | |||
| 14 | console.log(`Opening "/${sourceHtmlFile}"...`); |
||
| 15 | |||
| 16 | await page.goto(`file://${path.join(rootDir, sourceHtmlFile)}`, { waitUntil: 'networkidle0' }); |
||
| 17 | |||
| 18 | await page.pdf({ format: 'A4', path: targetPdf, margin: { top: 0, right: 0, bottom: 0, left: 0 } }); |
||
| 19 | |||
| 20 | await page.close(); |
||
| 21 | await browser.close(); |
||
| 22 | |||
| 23 | console.log('\n', `✅ All done! PDF exported to "/${targetPdf}".`); |
||
| 24 | } |
||
| 25 | |||
| 27 |