import argparse import fitz def join_files(first_pdf, second_pdf, output_pdf): doc = fitz.open() doc.insert_file(first_pdf) doc.insert_file(second_pdf) doc.save(output_pdf) doc.close() if __name__ == "__main__": parser = argparse.ArgumentParser(description="Join two PDFs into a third PDF") parser.add_argument("first_pdf", help="Path to the first PDF file.") parser.add_argument("second_pdf", help="Path to the second PDF file.") parser.add_argument("output_pdf", help="Path to destination PDF file.") args = parser.parse_args() join_files(args.first_pdf, args.second_pdf, args.output_pdf)