Я использую Electron для моего первого проекта, мне нужно распечатать файл PDF из моего HTML.
Что в моем коде сейчас:
ipc.on('print-to-pdf', event => {
const pdfPath = path.join(os.tmpdir(), 'temp_pdf.pdf')
const win = BrowserWindow.fromWebContents(event.sender)
win.webContents.printToPDF({marginsType: 1, pageSize:'Tabloid'}, (error, data) => {
if (error) return console.log(error.message)
fs.writeFile(pdfPath, data, err => {
if (err) return console.log(err.message)
shell.openExternal('file://' + pdfPath)
})
})
})
but when my app create .pdf file, the content is sliced in the second page.
Like that:
[Error pdf][1]
maybe it depends on the setting of the page size:
win.webContents.printToPDF({marginsType: 1, pageSize:'Tabloid'}, (error, data) => {
if (error) return console.log(error.message)
как я могу это исправить?
[1]: https://i.stack.imgur.com/dJ6tT.png