Skip to content

Helper script for emulating a duplex scan#56

Open
maciex wants to merge 2 commits intorocketraman:masterfrom
maciex:msitarz/features/helper_script_to_emulate_duplex_scans
Open

Helper script for emulating a duplex scan#56
maciex wants to merge 2 commits intorocketraman:masterfrom
maciex:msitarz/features/helper_script_to_emulate_duplex_scans

Conversation

@maciex
Copy link

@maciex maciex commented Nov 30, 2023

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 #40

@maciex maciex force-pushed the msitarz/features/helper_script_to_emulate_duplex_scans branch from 03b9ac9 to e70f9b5 Compare March 10, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simulated duplex scanning with page re-ordering

1 participant