From 3eaaad15d4b5132c6c40fb0df8734a5751eef25e Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 29 Feb 2024 09:04:55 +0400 Subject: [PATCH 1/6] Set header/footer height into html-pdf lib --- workers/loc.api/generate-report-file/pdf-writer/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/workers/loc.api/generate-report-file/pdf-writer/index.js b/workers/loc.api/generate-report-file/pdf-writer/index.js index 072a697f..c2245a8c 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/index.js +++ b/workers/loc.api/generate-report-file/pdf-writer/index.js @@ -110,6 +110,8 @@ class PdfWriter { template: 'No data', format: 'portrait', orientation: 'Letter', + headerHeight: '70mm', + footerHeight: '28mm', ...args } From b63219755a5eabef12cb7061a6f23d79b9c14627 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 29 Feb 2024 09:06:37 +0400 Subject: [PATCH 2/6] Move statement details section under logo for pdf reports --- .../pdf-writer/templates/style.css | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/workers/loc.api/generate-report-file/pdf-writer/templates/style.css b/workers/loc.api/generate-report-file/pdf-writer/templates/style.css index 5336a681..794fd64d 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/templates/style.css +++ b/workers/loc.api/generate-report-file/pdf-writer/templates/style.css @@ -40,7 +40,6 @@ html, body { box-sizing: border-box; } - html { line-height: 1; } @@ -52,11 +51,7 @@ body { html, body, .header, .footer { font-family: "Inter", sans-serif; font-weight: 400; - font-size: 8px; -} - -.sm { - font-size: 5px; + font-size: 11px; } h1 { @@ -292,8 +287,8 @@ h6 { .statement-details-content { position: absolute; - top: 11px; - right: 0; + top: 60px; + left: 0; line-height: 1; margin-bottom: 0; } @@ -316,7 +311,7 @@ h6 { /* Uses `mm` for height to support default settings of `html-pdf` lib */ .header-space, .header { - height: 43.5mm; + height: 70mm; } .footer-space, .footer { From f1c50d73c2c13f3eeb17f7e333094ac3f2eab927 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 29 Feb 2024 09:07:17 +0400 Subject: [PATCH 3/6] Normalize font size in base template --- .../loc.api/generate-report-file/pdf-writer/templates/base.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workers/loc.api/generate-report-file/pdf-writer/templates/base.pug b/workers/loc.api/generate-report-file/pdf-writer/templates/base.pug index 5c190652..9facf308 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/templates/base.pug +++ b/workers/loc.api/generate-report-file/pdf-writer/templates/base.pug @@ -40,7 +40,7 @@ html(lang=language) - const username = jobData.userInfo.username ?? email.replace(/@.*/, '') ?? '' .content.statement-details-content - ul.responsive-table.sm.width-by-content + ul.responsive-table.width-by-content li.table-header .col :translate(prop='template.statementDetails') From 8886ac254165f1fb74ba3d847ea75bdccdb6ad1a Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 29 Feb 2024 13:55:12 +0400 Subject: [PATCH 4/6] Fix header height consideration --- workers/loc.api/generate-report-file/pdf-writer/index.js | 2 +- .../generate-report-file/pdf-writer/templates/style.css | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/workers/loc.api/generate-report-file/pdf-writer/index.js b/workers/loc.api/generate-report-file/pdf-writer/index.js index c2245a8c..de39b2e3 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/index.js +++ b/workers/loc.api/generate-report-file/pdf-writer/index.js @@ -110,7 +110,7 @@ class PdfWriter { template: 'No data', format: 'portrait', orientation: 'Letter', - headerHeight: '70mm', + headerHeight: '54mm', footerHeight: '28mm', ...args } diff --git a/workers/loc.api/generate-report-file/pdf-writer/templates/style.css b/workers/loc.api/generate-report-file/pdf-writer/templates/style.css index 794fd64d..1d9d252c 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/templates/style.css +++ b/workers/loc.api/generate-report-file/pdf-writer/templates/style.css @@ -287,7 +287,7 @@ h6 { .statement-details-content { position: absolute; - top: 60px; + top: 40px; left: 0; line-height: 1; margin-bottom: 0; @@ -311,7 +311,7 @@ h6 { /* Uses `mm` for height to support default settings of `html-pdf` lib */ .header-space, .header { - height: 70mm; + height: 54mm; } .footer-space, .footer { From 1fbd11a5a26c40edafaa0f2aebb29550c778bf99 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 1 Mar 2024 09:44:05 +0200 Subject: [PATCH 5/6] Improve statement details content placing --- workers/loc.api/generate-report-file/pdf-writer/index.js | 2 +- .../generate-report-file/pdf-writer/templates/style.css | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/workers/loc.api/generate-report-file/pdf-writer/index.js b/workers/loc.api/generate-report-file/pdf-writer/index.js index de39b2e3..a04beaa3 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/index.js +++ b/workers/loc.api/generate-report-file/pdf-writer/index.js @@ -110,7 +110,7 @@ class PdfWriter { template: 'No data', format: 'portrait', orientation: 'Letter', - headerHeight: '54mm', + headerHeight: '65mm', footerHeight: '28mm', ...args } diff --git a/workers/loc.api/generate-report-file/pdf-writer/templates/style.css b/workers/loc.api/generate-report-file/pdf-writer/templates/style.css index 1d9d252c..e67e40e4 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/templates/style.css +++ b/workers/loc.api/generate-report-file/pdf-writer/templates/style.css @@ -287,7 +287,7 @@ h6 { .statement-details-content { position: absolute; - top: 40px; + top: 50px; left: 0; line-height: 1; margin-bottom: 0; @@ -311,7 +311,7 @@ h6 { /* Uses `mm` for height to support default settings of `html-pdf` lib */ .header-space, .header { - height: 54mm; + height: 65mm; } .footer-space, .footer { From 222d8aac367259a92b4afb870d2c80dc1e1e2070 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 1 Mar 2024 09:46:27 +0200 Subject: [PATCH 6/6] Fix common-content-header for phantomjs rendering --- .../pdf-writer/templates/style.css | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/workers/loc.api/generate-report-file/pdf-writer/templates/style.css b/workers/loc.api/generate-report-file/pdf-writer/templates/style.css index e67e40e4..75289d22 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/templates/style.css +++ b/workers/loc.api/generate-report-file/pdf-writer/templates/style.css @@ -164,6 +164,20 @@ h6 { color: #3e4444; } +/* + The fix for Phantomjs rendering +*/ +.common-content-header { + border-width: 1px; + border-color: rgba(255, 255, 255, 0); + border-top-style: solid; + border-bottom-style: solid; +} + +.no-phantomjs .common-content-header { + border: 0; +} + .responsive-table { margin-bottom: 20px; }