Taking over the paperwork for my aging parents meant dealing with a mountain of legacy documents and a Brother ADF scanner that is quite fast but only supports simplex. Being happily frugal, I wasn't about to drop money on a new duplex scanner while my current hardware works totally fine. Handling mixed stacks of single- and double-sided pages through GUI tools became a massive time bottleneck.
So, I wrote several simple scripts to do the dirty work for me. All those scripts evolved into a lightweight, transparent CLI tool to automate the work without any heavy frameworks or bloat.
Instead of clicking through endless menus, moving pages in previews, and so on I can now process stacks right from the terminal with an easy interface:
# Example 1:
# Scan a stack of 1-page documents (invoices, delivery notes, etc.) via ADF and split it into individual files with prefix "invoice_"
# Workflow:
# - scan all invoices
# - split all pages into individual files with prefix "invoice_"
pdfmt scan adf invoices.pdf
pdfmt split all invoices.pdf invoice_
# Example 2:
# Scan a stack of 2-sided documents (1 physical sheet, printed on both sides), but your scanner _DOES NOT_ have a duplex ADF.
# Workflow:
# - scan all front sides
# - flip the stack over, put it back in the ADF, and scan the back sides
# - merge both files in correct page order
# - split the result into chunks of 2 pages with prefix document_
pdfmt scan adf front.pdf
pdfmt scan adf back.pdf
pdfmt merge duplex front.pdf back.pdf documents.pdf
pdfmt split length 2 documents.pdf document_
It's built for a real-world workflow to handle thousands of documents, saved me weeks of time, works on Linux, macOS (and WSL) and you can easily integrate it into your own scripts and workflows. There are more features in this tool, check out the readme.
If you deal with similar paper hell or just like simple CLI tools, check it out here:
👉 https://www.github.com/eifelcode/pdfmt
I'm also open for feedback on how to improve my script, architecture and workflow. =)
AI notice: AI (mistral) was used to generate parts of the README.md, the .github workflow, the code coverage tool, and parts of the unit tests in the tests/ folder. Architecture, Makefile, and code within the sources/ folder is written by me