From 72a39434e8ceba72288fa91fe52d4f992af651a1 Mon Sep 17 00:00:00 2001 From: dickreckard Date: Thu, 15 Dec 2022 00:54:55 +0100 Subject: [PATCH] add empty pages for evenness --- pdf-compile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pdf-compile.py b/pdf-compile.py index baa3bff..d42e4dd 100755 --- a/pdf-compile.py +++ b/pdf-compile.py @@ -135,7 +135,12 @@ for chapter in chapters: outputs.append(localhost+pdffile) counter+=1 - page=page+pypdftk.get_num_pages(localhost+pdffile) + pagenr=pypdftk.get_num_pages(localhost+pdffile) + if (pagenr % 2) != 0: + pypdftk.concat([localhost+pdffile,localhost+'blank.pdf'],localhost+'temp.pdf') + os.replace(localhost+'temp.pdf',localhost+pdffile) + pagenr+=1 + page=page+pagenr # compiling all the files in one big pdf!