Simon Bruder
9202a01802
All checks were successful
continuous-integration/drone/push Build is passing
25 lines
594 B
JavaScript
25 lines
594 B
JavaScript
const puppeteer = require('puppeteer');
|
|
const process = require('process')
|
|
|
|
const name = process.argv[2];
|
|
|
|
(async () => {
|
|
const browser = await puppeteer.launch({
|
|
args: [
|
|
'--no-sandbox',
|
|
'--disable-setuid-sandbox'
|
|
]
|
|
})
|
|
|
|
const page = await browser.newPage()
|
|
await page.goto('file://' + process.cwd() + '/namensschild.html', {waitUntil: 'networkidle2'})
|
|
await page.$eval('#name', (el, name) => { el.innerText = name; setSize() }, name)
|
|
await page.pdf({
|
|
path: `static/namensschild.pdf`,
|
|
width: '180px',
|
|
height: '60px'
|
|
})
|
|
|
|
await browser.close()
|
|
})()
|