From 6951b2303884f8396b311bfbff7186f1b50fc045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Sch=C3=A4r?= Date: Wed, 11 Sep 2024 08:54:18 +0200 Subject: [PATCH] toc length calculation includes page margins (top and bottom) (#2038) --- .../print_proxy/mapfish_print/toc_pages.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pyramid_oereb/contrib/print_proxy/mapfish_print/toc_pages.py b/pyramid_oereb/contrib/print_proxy/mapfish_print/toc_pages.py index 7e6c580127..b3c8b8d261 100644 --- a/pyramid_oereb/contrib/print_proxy/mapfish_print/toc_pages.py +++ b/pyramid_oereb/contrib/print_proxy/mapfish_print/toc_pages.py @@ -8,7 +8,10 @@ class TocPages(): def __init__(self, extract): - self.disposable_height = 842 - 70 # A4 size - (footer + header); toc.jrxml + self.total_height = 842 + self.header_height = self.compute_header() + self.footer_height = self.compute_footer() + self.disposable_height = 842 - self.header_height - self.footer_height # A4 size - (footer + header) self.d1_height = 77 # toc.jrxml self.d2_height = 29 # toc.jrxml self.d3_height = 61 # toc.jrxml @@ -21,6 +24,21 @@ def __init__(self, extract): self.display_qrcode = self.extract['Display_QRCode'] self.total_length = self.compute_total_lenght() + def compute_header(self): + total_size = 0 + page_top_margin = 28 # toc.jrxml + header_height = 60 # toc.jrxml + total_size += page_top_margin + header_height + log.debug(f"header total_size: {total_size}") + return total_size + + def compute_footer(self): + total_size = 0 + page_bottom_margin = 20 # toc.jrxml + footer_height = 10 # toc.jrxml + log.debug(f"header total_size: {total_size}") + return total_size + def compute_d1(self): # The ConcernedTheme-Heading cannot be calculated at runtime. The used label # is defined in the mfp-templates which are not accessible here. Therefore