desktop app(export pdf): add page numbering

This commit is contained in:
Adorian Doran 2025-02-01 14:37:21 +02:00
parent 50514e2418
commit a1dfeb14e1

View File

@ -75,7 +75,14 @@ ipcMain.on("export-as-pdf", async (e, opts: ExportAsPdfOpts) => {
let buffer: Buffer;
try {
buffer = await browserWindow.webContents.printToPDF({
landscape: opts.landscape
landscape: opts.landscape,
displayHeaderFooter: true,
headerTemplate: `<div></div>`,
footerTemplate: `
<div style="width: 100%; text-align: center; font-size: 10pt;">
<span class="pageNumber"></span>
</div>
`
});
} catch (e) {
dialog.showErrorBox(t("pdf.unable-to-export-title"), t("pdf.unable-to-export-message"));