PDF merge and splitDevelopment & Customization

A Python script that merges PDF files into one or splits large PDFs into parts by pages or by rules

Usually ready in 15 minutesRevisions includedQuality check
Packages
Payment protectionDetails
  • Revisions within the package are free.
  • If you do not respond within 3 days of delivery, the work is accepted automatically.

The money is reserved when you pay and released only once you accept the work.

A Python script that merges PDF files into one or splits large PDFs into parts by pages or by rules

Example result

Example for the Standard package

Merging the monthly sales files of 9 shops into one Excel report

How it is run

python merge_sales.py --month 2026-10
2026-11-02 09:14:03 INFO  Folder: sales/2026-10, 9 files found
2026-11-02 09:14:03 INFO  shop-01.csv: 1,284 rows
2026-11-02 09:14:04 INFO  shop-02.xlsx: 967 rows
2026-11-02 09:14:04 WARN  shop-07.csv: 3 rows without a price skipped (lines 88, 412, 913)
2026-11-02 09:14:05 INFO  Done: 10,412 rows -> report-2026-10.xlsx (sheets "Sales" and "Totals")

Settings, not code

The column names of each shop live in settings.ini, so a new shop or a renamed column is a line there:

[columns]
date = Date, Sale date, Day
product = Product, Item, Name
quantity = Qty, Quantity, Pcs
price = Price, Unit price

A part of the code

def read_shop_file(path: Path, columns: dict[str, list[str]]) -> pd.DataFrame:
    """Reads one shop's file and gives it the report's column names."""
    table = pd.read_excel(path) if path.suffix == ".xlsx" else pd.read_csv(path, encoding="utf-8-sig")
    renamed = {}
    for name, variants in columns.items():
        found = next((c for c in table.columns if c.strip() in variants), None)
        if found is None:
            raise ReportError(f"{path.name}: no column for '{name}' (looked for {', '.join(variants)})")
        renamed[found] = name
    table = table.rename(columns=renamed)[list(columns)]
    table["shop"] = path.stem
    return table

Files: a ZIP archive with merge_sales.py (310 lines), settings.ini, requirements.txt and a README with installing Python, running the script and what each message in the log means. The client runs it on their own computer.

Client: a small chain of 9 stationery shops; each shop sends its sales for the month as a CSV or Excel file, with slightly different column names. Task: one script that reads every file in a folder, brings the columns to one shape, and writes a single Excel report with all sales and a sheet of totals by shop.

The client and all details are made up.

About this service

Scanned contracts that came as one file per page, a 300-page statement that needs to go out client by client, a set of documents that has to be sent as one PDF: this Python script does such PDF jobs in seconds instead of clicking through an editor. It merges files in the order you set (by name, by date or from a list), splits a PDF into single pages, fixed ranges or parts that start at each bookmark, and in Premium can cut where a page contains a word you name, such as Invoice No. Pages keep their quality because they are copied, not printed again. Send us the job and one or two sample files with nothing private in them. You run the script yourself on your computer. It does not edit text or read scans.

What is included

  • What you getA ZIP archive with the Python script, a README with step-by-step instructions and, from Standard, a settings file with order, ranges and names; the code is also shown on the order page.
  • Merge in your orderBy name, date or a list you give
  • Split your waySingle pages, ranges or bookmarks
  • No loss of qualityPages are copied as they are
  • Clear file namesNumbers, page ranges or names from your list
  • Readable codeWith comments, easy to change a rule later

How it works

  1. 1
    TaskYou describe the job and send one or two sample PDFs
  2. 2
    CodeWe write the script and the guide to running it
  3. 3
    Try itYou run it on copies of your files and check the pages
  4. 4
    ChangesYou ask for changes within your package and send any error message

What we need from you

What you need done: which files to merge and in what order, or how to split (every page, every N pages, by ranges, by bookmarks or by a word on the page), and how to name the results. One or two sample PDFs with nothing private in them, or the same layout with made-up content; if the split depends on a word, a page that shows it. Roughly how many files and pages, and your system: Windows, macOS or Linux.

We will ask you:

  • Merge, split, or one after the other?
  • How do you know where each part starts?
  • How should the files be named?
  • Where will it run?

Compare packages

PackagesBasicMerge or split$16StandardPDF with settings$33PremiumPDF tool$67
Deadline1 day2 days3 days
Revisions123
Codeup to 150 linesup to 400 linesup to 1,000 lines
Files of code1up to 3up to 8
Settings fileNoYesYes
Clear error messages and a logNoYesYes
Run options and a guide to running it on a scheduleNoNoYes
Guide to installing and running it (README)YesYesYes
LanguagePythonPythonPython
Order BasicOrder StandardOrder Premium

Payment protection

You pay when you order, but the money is released only for accepted work.

  • Fixed priceThe package price does not change after you pay.
  • The money is reservedWhen you pay, the amount is only reserved. It is released to the service once you accept the work.
  • Checked before deliveryEvery result goes through a quality check before it reaches you, and you see it on the order page before accepting it.
  • Free revisionsAsk for changes within your brief as many times as the package allows.
  • Acceptance after 3 daysIf within 3 days of delivery you neither accept the work nor ask for changes, it is accepted automatically. If you write in the order chat after delivery, the order waits; once we answer, we may start the 3 days again and will say so in the chat.
  • Redo or a full refundIf the result does not match your brief and the revisions did not fix it, or the work takes more than twice its deadline, write in the order chat: we will redo the work or refund the payment in full.
How it works →

Questions and answers

Can it split scanned PDFs by a word?

No: a scan is a picture of a page, with no text to search. Splitting scans by page numbers or ranges works fine. Splitting by a word needs a PDF with real text, such as one saved from a program.

What about password-protected PDFs?

If you know the password, the README shows how to give it to the script when you run it; it is never written into the code. Files you have no password for are skipped and listed in the log.

Can it compress the PDFs too?

Light compression of the file structure, yes. Making scans much smaller means recompressing the pictures inside, which changes their quality; ask in the brief and we will say whether it fits your package.

Will you process my documents?

No. You run the script on your computer, so contracts and statements never leave it. Send us only samples with nothing private.

Did not find your answer?

Packages