From: Christian Heller Date: Sat, 23 Sep 2023 23:22:21 +0000 (+0200) Subject: In Bookmaker, add spine size parameter. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/processes?a=commitdiff_plain;h=6a37ff4cbeb43c7f609fd5f6a0e442e66fd478ed;p=misc In Bookmaker, add spine size parameter. --- diff --git a/bookmaker.py b/bookmaker.py index 4a7ed31..72ffbfa 100755 --- a/bookmaker.py +++ b/bookmaker.py @@ -6,15 +6,16 @@ from reportlab.lib.pagesizes import A4 a4_width, a4_height = A4 parser = argparse.ArgumentParser(description="build print-ready book PDF") -parser.add_argument("-i", "--input", dest="input_file", action="append", required=True, help="input PDF file") -parser.add_argument("-o", "--output", dest="output_file", required=True, help="output PDF file") -parser.add_argument("-p", "--pages", dest="page_range", action="append", help="page range, e.g., '3-end'") -parser.add_argument("-c", "--crop", dest="crop_range", action="append", help="crops left, bottom, right, top – e.g., '10,10,10,10'; prefix with ':'-delimited page range to limit effect") -parser.add_argument("-n", "--nup4", dest="nup4", action='store_true', help="puts 4 input pages onto 1 output page") -parser.add_argument("-a", "--analyze", dest="analyze", action="store_true", help="print lines identifying spine, page borders") -parser.add_argument("-t", "--symmetry", dest="symmetry", action="store_true", help="alternate horizontal crops between odd and even pages") +parser.add_argument("-i", "--input_file", action="append", required=True, help="input PDF file") +parser.add_argument("-o", "--output_file", required=True, help="output PDF file") +parser.add_argument("-p", "--page_range", action="append", help="page range, e.g., '3-end'") +parser.add_argument("-c", "--crop_range", action="append", help="crops left, bottom, right, top – e.g., '10,10,10,10'; prefix with ':'-delimited page range to limit effect") +parser.add_argument("-n", "--nup4", action='store_true', help="puts 4 input pages onto 1 output page") +parser.add_argument("-a", "--analyze", action="store_true", help="print lines identifying spine, page borders") +parser.add_argument("-t", "--symmetry", action="store_true", help="alternate horizontal crops between odd and even pages") parser.add_argument("-r", "--rotate", dest="rotate", type=int, action="append", help="rotate page of number by 90° (usable multiple times on same page!)") parser.add_argument("-m", "--margin", type=float, default=4.3, help="print margin in mm (default 4.3)") +parser.add_argument("-s", "--spine", type=float, default=10, help="on --nup4, mm width of margin hidden in spine (default 10)") args = parser.parse_args() @@ -113,7 +114,7 @@ if not args.nup4: else: points_per_mm = 2.83465 n_pages_per_axis = 2 - spine_limit = 10 + spine_limit = args.spine * points_per_mm printable_margin = args.margin * points_per_mm printable_scale = (a4_width - 2*printable_margin)/a4_width half_width = a4_width / n_pages_per_axis