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 751a20ff53..d9a9f62f3b 100644 --- a/pyramid_oereb/contrib/print_proxy/mapfish_print/toc_pages.py +++ b/pyramid_oereb/contrib/print_proxy/mapfish_print/toc_pages.py @@ -71,12 +71,14 @@ def compute_d3(self): blank_space_above = 26 # toc.jrxml not_concerned_themes_title_height = 15 # toc.jrxml blank_space_between = 5 # toc.jrxml - not_concerned_themes_item_height = 15 # toc.jrxml (12 in themelist.jrxml) + not_concerned_themes_first_item_height = 15 # toc.jrxml + not_concerned_themes_further_items_height = 12 # themelist.jrxml total_size += ( blank_space_above + not_concerned_themes_title_height + blank_space_between ) - total_size += ( - len(self.extract["NotConcernedTheme"]) * not_concerned_themes_item_height + total_size += not_concerned_themes_first_item_height + ( + (len(self.extract["NotConcernedTheme"]) - 1) + * not_concerned_themes_further_items_height ) log.debug(f"d3 total_size: {total_size}") if total_size > self.d3_height: @@ -93,9 +95,11 @@ def compute_d4(self): def compute_d5(self): total_size = 0 - theme_without_data_item_height = 15 # toc.jrxml (12 in themelist.jrxml) - total_size += len( - self.extract["ThemeWithoutData"] * theme_without_data_item_height + theme_without_data_first_item_height = 15 # toc.jrxml + theme_without_data_further_items_height = 12 # themelist.jrxml + total_size += theme_without_data_first_item_height + ( + (len(self.extract["ThemeWithoutData"]) - 1) + * theme_without_data_further_items_height ) log.debug(f"d5 total_size: {total_size}") if total_size > self.d5_height: diff --git a/tests/contrib.print_proxy.mapfish_print/test_mapfish_print.py b/tests/contrib.print_proxy.mapfish_print/test_mapfish_print.py index 61d91b39aa..d107026994 100644 --- a/tests/contrib.print_proxy.mapfish_print/test_mapfish_print.py +++ b/tests/contrib.print_proxy.mapfish_print/test_mapfish_print.py @@ -39,6 +39,7 @@ def extract(): ) as f: yield json.load(f) + @pytest.fixture def extract_toc_pages(): with codecs.open( @@ -46,6 +47,7 @@ def extract_toc_pages(): ) as f: yield json.load(f) + @pytest.fixture def extract_multi_wms(): with codecs.open(