Add CLI
This commit is contained in:
parent
53aa2d20d4
commit
5738478ef2
1 changed files with 13 additions and 4 deletions
17
foliator.py
17
foliator.py
|
|
@ -64,8 +64,17 @@ def blit_to_A4(input_pdf, append_to=PdfWriter()):
|
||||||
back_page.merge_page(back)
|
back_page.merge_page(back)
|
||||||
return writer
|
return writer
|
||||||
|
|
||||||
input_pdf = PdfReader("to_foliate.pdf")
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("infile", help="input document, A6 pages")
|
||||||
|
parser.add_argument("outfile", help="output document")
|
||||||
|
parser.add_argument("-a5", help="output as a5, reverse on short edge",
|
||||||
|
action="store_true")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
input_pdf = PdfReader(args.infile)
|
||||||
a5 = foliate_A6(input_pdf)
|
a5 = foliate_A6(input_pdf)
|
||||||
a5.write("output_A5.pdf")
|
if (args.a5):
|
||||||
a4 = blit_to_A4(a5)
|
a5.write(args.outfile)
|
||||||
a4.write("output_A4.pdf")
|
else:
|
||||||
|
a4 = blit_to_A4(a5)
|
||||||
|
a4.write(args.outfile)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue