Skip to content

Commit

Permalink
toc length calculation includes page margins (top and bottom) (#2038)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschaer committed Sep 11, 2024
1 parent 2ebf392 commit 6951b23
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pyramid_oereb/contrib/print_proxy/mapfish_print/toc_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6951b23

Please sign in to comment.