template header & footer margins

This commit is contained in:
Julian Krauser 2025-01-01 13:21:28 +01:00
parent b5760202f7
commit cfefcd81d7
10 changed files with 72 additions and 17 deletions

View file

@ -11,7 +11,6 @@ export abstract class PdfExport {
filename = null,
data = {},
saveToDisk = true,
margins = { top: "15mm", bottom: "15mm" },
folder = "",
}: {
template: PermissionModule;
@ -19,12 +18,11 @@ export abstract class PdfExport {
filename?: string;
data?: any;
saveToDisk?: boolean;
margins?: { top: string; bottom: string };
folder?: string;
}) {
if (folder != "") FileSystemHelper.createFolder(folder);
const { header, footer, body } = await TemplateHelper.renderFileForModule({
const { header, footer, body, headerMargin, footerMargin } = await TemplateHelper.renderFileForModule({
module: template,
headerData: data,
bodyData: data,
@ -46,8 +44,8 @@ export abstract class PdfExport {
format: "A4",
printBackground: false,
margin: {
top: margins.top,
bottom: margins.bottom,
top: (headerMargin ?? 15) + "mm",
bottom: (footerMargin ?? 15) + "mm",
left: "10mm",
right: "10mm",
},