Created
October 22, 2025 17:38
-
-
Save lordjabez/c1fb8ffc221fff703fe9354b428dad66 to your computer and use it in GitHub Desktop.
Merge a set of PDFs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| import pypdf | |
| output_filename = sys.argv[1] | |
| input_filenames = sys.argv[2:] | |
| merger = pypdf.PdfWriter() | |
| for input_filename in input_filenames: | |
| merger.append(input_filename) | |
| with open(output_filename, 'wb') as output_file: | |
| merger.write(output_file) | |
| print(f'Successfully merged PDFs into "{output_filename}"') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment