diff --git a/foliator.py b/foliator.py index d380859..da269db 100755 --- a/foliator.py +++ b/foliator.py @@ -88,11 +88,23 @@ def foliate_A6(input_pdf, strat_func, max_folio_size, append_to=PdfWriter()): folio_page_size = 0 current_page = 0 + + print("Folio sizes, in order") + old_l = L[0] + old_l_run = 0 for l in L: + if l != old_l: + print(old_l, "a5 sheet(s), x", old_l_run) + old_l = l + old_l_run = 1 + else: + old_l_run += 1 + # l is a number of _sheets_, each containing 4 pages folio_page_size = min(doc_length - current_page, 4*l) append_folio_A6(input_pdf, current_page, folio_page_size, append_to) current_page += folio_page_size + print(old_l, "a5 sheet(s), x", old_l_run) return writer