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("-s", "--second", dest="second", help="append second file as input to append")
args = parser.parse_args()
with open(args.input_file, 'rb') as file:
pages_to_add += [page]
print("read in page number", page_num+1)
+ # add pages of second PDF
+ if args.second:
+ file2 = open(args.second, 'rb')
+ reader2 = pypdf.PdfReader(file2)
+ page_num = 1
+ for page in reader2.pages:
+ pages_to_add += [page]
+ print("read second PDF's page number", page_num)
+ page_num += 1
+
# normalize all pages to A4
- for page_num in range(start_page, end_page):
- page = reader.pages[page_num]
+ for page in pages_to_add:
page.mediabox.left = 0
page.mediabox.bottom = 0
page.mediabox.top = a4_height
with open(args.output_file, 'wb') as output_file:
writer.write(output_file)
+ if args.second:
+ file2.close()