@@ -170,7 +197,7 @@ electron.ipcMain.on("export-as-pdf", async (e, { title, notePath, landscape, pag
}
});
-electron.ipcMain.on("export-as-pdf-preview", async (e, { notePath, landscape, pageSize, scale }: ExportAsPdfOpts) => {
+electron.ipcMain.on("export-as-pdf-preview", async (e, { notePath, landscape, pageSize, scale, margins }: ExportAsPdfOpts) => {
try {
const { browserWindow, printReport } = await getBrowserWindowForPrinting(e, notePath, "exporting_pdf");
@@ -179,10 +206,11 @@ electron.ipcMain.on("export-as-pdf-preview", async (e, { notePath, landscape, pa
landscape,
pageSize,
scale,
+ margins: parseMargins(margins),
generateDocumentOutline: true,
generateTaggedPDF: true,
printBackground: true,
- displayHeaderFooter: true,
+ displayHeaderFooter: !margins || margins === "default",
headerTemplate: `
`,
footerTemplate: `
diff --git a/packages/commons/src/lib/attribute_names.ts b/packages/commons/src/lib/attribute_names.ts
index 0442031831..93c99dc3ee 100644
--- a/packages/commons/src/lib/attribute_names.ts
+++ b/packages/commons/src/lib/attribute_names.ts
@@ -64,6 +64,7 @@ type Labels = {
printLandscape: boolean;
printPageSize: string;
printScale: string;
+ printMargins: string;
// Note-type specific
webViewSrc: string;
diff --git a/packages/commons/src/lib/builtin_attributes.ts b/packages/commons/src/lib/builtin_attributes.ts
index 0ef66064ec..0c23632a6c 100644
--- a/packages/commons/src/lib/builtin_attributes.ts
+++ b/packages/commons/src/lib/builtin_attributes.ts
@@ -86,6 +86,7 @@ export default [
{ type: "label", name: "printLandscape" },
{ type: "label", name: "printPageSize" },
{ type: "label", name: "printScale" },
+ { type: "label", name: "printMargins" },
// relation names
{ type: "relation", name: "internalLink" },