From 36859c826240483f8cdd2743031d9a6f03d49c16 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 10 Jan 2016 16:31:56 +0200 Subject: [PATCH] Only show header on the first page of the PDF --- public/js/built.js | 9 +++++++-- public/js/pdf.pdfmake.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/public/js/built.js b/public/js/built.js index 044b9c6931..4331c86991 100644 --- a/public/js/built.js +++ b/public/js/built.js @@ -30926,8 +30926,13 @@ function GetPdfMake(invoice, javascript, callback) { } } - // only show the footer on the last page - if (invoice.is_pro && key === 'footer') { + // only show the header on the first page + // and the footer on the last page + if (key === 'header') { + return function(page, pages) { + return page === 1 ? val : ''; + } + } else if (invoice.is_pro && key === 'footer') { return function(page, pages) { return page === pages ? val : ''; } diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index 52f3910b50..11403d60cb 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -54,8 +54,13 @@ function GetPdfMake(invoice, javascript, callback) { } } - // only show the footer on the last page - if (invoice.is_pro && key === 'footer') { + // only show the header on the first page + // and the footer on the last page + if (key === 'header') { + return function(page, pages) { + return page === 1 ? val : ''; + } + } else if (invoice.is_pro && key === 'footer') { return function(page, pages) { return page === pages ? val : ''; }