Skip to content

Instantly share code, notes, and snippets.

@sgrontflix
sgrontflix / pdf_merge.py
Last active July 30, 2025 13:45
Simple script that allows you to merge PDF files. You can also specify which pages to consider when merging.
import argparse
import re
from pathlib import Path
from PyPDF2 import PdfMerger
from PyPDF2.errors import PyPdfError
def parse_pages(pages_list, files):
# no ranges => select all pages
# "None" means "all pages" in pypdf2