summaryrefslogtreecommitdiff
path: root/planner/planner_generator.py
diff options
context:
space:
mode:
Diffstat (limited to 'planner/planner_generator.py')
-rwxr-xr-xplanner/planner_generator.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/planner/planner_generator.py b/planner/planner_generator.py
index 906c0fc..2da3133 100755
--- a/planner/planner_generator.py
+++ b/planner/planner_generator.py
@@ -6,6 +6,7 @@ import datetime
import locale
import logging
import os
+import re
import shutil
import subprocess
import sys
@@ -87,6 +88,8 @@ class Generator:
return "a5"
if "A4" in template:
return "a4"
+ if "×" in template:
+ return re.findall(r"\d+×\d+", template)[0]
return "a6"
def _get_cover_name(self, cover_template):
@@ -163,14 +166,20 @@ class Generator:
def join_pages(self):
pdf_pages = self.get_pdf_pages()
- try:
- subprocess.run([
+ command = [
"pdfjam",
"--outfile", self.out_file,
"--scale", "1",
- "--paper", "{}paper".format(self.paper_size),
- *pdf_pages
- ])
+ ]
+ if "×" in self.paper_size:
+ x, y = self.paper_size.split("×")
+ size = "{" + x + "mm," + y + "mm}"
+ command.extend(["--papersize", size])
+ else:
+ command.extend(["--paper", "{}paper".format(self.paper_size)])
+ command.extend(pdf_pages)
+ try:
+ subprocess.run(command)
except FileNotFoundError:
logging.warning("pdfjam is not installed")
logging.warning("you will have to join the pdf pages yourself")