diff --git a/pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py b/pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py index bc976a3707..a0b7ddb3cc 100644 --- a/pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py +++ b/pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py @@ -75,14 +75,6 @@ def __call__(self, value, system): print_config = Config.get('print', {}) - if print_config.get('compute_toc_pages', False): - extract_as_dict['nbTocPages'] = TocPages(extract_as_dict).getNbPages() - else: - if print_config.get('expected_toc_length') and int(print_config.get('expected_toc_length')) > 0: - extract_as_dict['nbTocPages'] = print_config.get('expected_toc_length') - else: - extract_as_dict['nbTocPages'] = 1 - # set the global_datetime variable so that it can be used later for the archive self.set_global_datetime(extract_as_dict['CreationDate']) self.convert_to_printable_extract(extract_as_dict, feature_geometry) @@ -102,7 +94,10 @@ def __call__(self, value, system): if print_config.get('compute_toc_pages', False): extract_as_dict['nbTocPages'] = TocPages(extract_as_dict).getNbPages() else: - extract_as_dict['nbTocPages'] = 1 + if print_config.get('expected_toc_length') and int(print_config.get('expected_toc_length')) > 0: + extract_as_dict['nbTocPages'] = print_config.get('expected_toc_length') + else: + extract_as_dict['nbTocPages'] = 1 spec = { 'layout': print_config['template_name'],