sane-scan-pdf
sane-scan-pdf copied to clipboard
Helper script for emulating a duplex scan
First idea of the script was to separate each document and then unite it, smth similar to this:
pdfseparate "$file_A" $TMP_DIR/scan-separated-%d-A.pdf
pdfseparate "$file_B" $TMP_DIR/scan-separated-%d-B.pdf
pdfunite $TMP_DIR/scan-separated-*-*.pdf "$output_file"
The script assumed odd pages and even pages are scanned in ascending order. So before a scan one would need to change the order of all the pages to get a proper scan document... but we can scan the sheets in descending order and then reverse using some tools.
After some research on PDF tools that are able to split/merge/reverse the order of the pages in the PDF... the "script" boils down to one command:
qpdf --collate --empty --pages odd.pdf even.pdf z-1 -- output.pdf
I wrapped the command into a helper script and added a short README mention.
Fixes https://github.com/rocketraman/sane-scan-pdf/issues/40