From 7d34cf9f3f1ab5ca75267533c77f6a9cb1623dee Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Fri, 17 Oct 2025 10:24:30 +0200 Subject: [PATCH] improve chunking preformance --- src/pretix/base/invoicing/pdf.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pretix/base/invoicing/pdf.py b/src/pretix/base/invoicing/pdf.py index 2e961ec44e..3a47fe641c 100644 --- a/src/pretix/base/invoicing/pdf.py +++ b/src/pretix/base/invoicing/pdf.py @@ -793,9 +793,13 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer): p_style = self.stylesheet['Fineprint'] continue - if h > max_height * 1.25: + if not description_p_list: + # first "manual" line is larger than 8 "real" lines => only allow one line and set rest in Fineprint + max_height = self.stylesheet['Normal'].leading + + if h > max_height * 1.1: # quickly bring the text-length down to a managable length to then stepwise reduce - wrap_to = math.ceil(len(curr_description) * max_height * 1.25 / h) + wrap_to = math.ceil(len(curr_description) * max_height * 1.1 / h) else: # long trimming long texts by percent creates to big jumps, but trimming short texts # by e.g. static 10 chars might be to much also