The cheaper scanners with Automatic Document Feeder (ADF) out there do not offer full duplex document feed in scanning. This makes your life a misery if you want to scan a double-sided document. You either have to scan each page separately, or you end up with two separate documents: one with odd and another with the even pages. But how can you merge odd and even scanned pages to a single, smoothly flowing document?
Preparing the scanned pages
If you have scanned each side separately you have most probably ended up with two documents: one holding the odd pages (odd.pdf) and another with the even pages in reverse order (even_reversed.pdf). The even pages are reversed when you place your document face-down in the ADF.
The steps to achieve the result we want are as follows:
Step 1: Reverse the page order of the even_reversed.pdf: print the document as PDF, with the Reversed checkbox ticked. This will produce a new PDF document, let’s call this even.pdf.
Step 2: Explode the documents to single pages: use the pdfseparate tool to explode each document into separate pages. The naming of the pages is critical, since it ensures the correct document composition at the next step. Use the following commands:
pdfseparate odd.pdf %04d_a.pdf
pdfseparate even.pdf %04d_b.pdf
The %04d part of the command sets the number of numerical digits for the newly created PDF files, e.g. 0001_a.pdf, 0002_a.pdf etc.
Placing the _a and _b at the end of the argument in the above command lines will result in a correct sorting of the resulting pages for the need of combining them to a single document in the following step.
Merge odd and even scanned pages
Step 3: Remove the initial files (odd.pdf, even_reversed.pdf & even.pdf) from the folder and combine the remaining single-page PDFs to a unified document using the following command:
pdfunite *.pdf out.pdf
This will result in the out.pdf document, which is the final unified document we want.