Combine front and back scanned pages into one PDF

Interleaving merges two PDFs by alternating their pages: page 1 of the first file, page 1 of the second, page 2 of the first, and so on. It is the standard fix for scanning a double-sided stack on a single-sided scanner in two passes — load the fronts as the first file and the backs as the second. Because flipping the stack makes the backs come out in reverse, the tool reverses the second file by default, and the whole merge runs privately in your browser.

Interleave two PDFs — runs on your device

How it works

Start with what the scanner actually produces. Feed a 10-sheet double-sided stack through a single-sided document feeder and the first pass captures the odd-numbered sides in order: 1, 3, 5, … 19. Now flip the whole stack over to scan the backs. The sheet that was on the bottom is now on top, so the second pass captures the even sides backward: 20, 18, 16, … 2. Two files, both "in order" from the scanner's point of view, neither in reading order.

The fix is pure index arithmetic. With the reverse-second-file option on (the default), output position 2i − 1 takes page i of the fronts file, and position 2i takes page n − i + 1 of the backs file — the backs are consumed from the end toward the start. For the 10-sheet example: front 1 (page 1), then the last back (page 2), then front 2 (page 3), then the second-to-last back (page 4), continuing until both files are exhausted. If your scanner software already un-reverses the backs, or you are weaving two ordinary documents (say, translations facing originals), switch the option off and both files are read front-to-front.

Structurally this is a cross-document copy. The tool creates a fresh PDF and uses pdf-lib's page copier, which walks each source page's object graph — content streams, the scanned image XObjects, any fonts — and transplants those objects into the new file, renumbering references as it goes. The scan images are moved as-is: no re-rendering, no JPEG recompression, no resolution change. A page interleaved from either file is byte-equivalent in appearance to the page in its source.

When the two files differ in length, alternation runs while both have pages, and the surplus from the longer file is appended at the end so nothing is silently discarded. In a duplex-scan scenario the counts should match exactly; a mismatch is a reliable sign the feeder pulled two sheets at once in one of the passes, and it is worth re-scanning before you shred the originals.

Worked example: a 20-page contract scanned in two passes

A 10-sheet, 20-page signed contract goes through a single-sided ADF. Pass one produces fronts.pdf: 10 pages, 4.2 MB, containing document pages 1, 3, 5, … 19. The stack is flipped and pass two produces backs.pdf: 10 pages, 3.9 MB, containing document pages 20, 18, 16, … 2 — reversed, exactly as expected.

Loading fronts.pdf first, backs.pdf second, and leaving "reverse second file" checked yields a single 20-page PDF of about 8.1 MB, in true order 1 through 20. The output is essentially the sum of the two inputs because the scan images are copied without recompression; the extra ~40 KB is new document structure. Had the reverse option been off by mistake, the result would read 1, 20, 3, 18, 5, 16, … — a telltale pattern worth recognizing: correct fronts, backs counting down.

Frequently asked questions

How do I combine front and back pages scanned separately?

Scan the stack once for the fronts, flip it over and scan again for the backs, then load the fronts as file one and the backs as file two. The tool alternates them — reversing the backs automatically — into one PDF in reading order.

Why are my scanned back pages in reverse order?

When you flip a stack to feed it through a single-sided scanner again, the last sheet goes through first, so the backs come out last-to-first. That is expected — leave the reverse-second-file option on and the tool corrects it.

What happens if the two PDFs have different page counts?

The tool alternates pages for as long as both files have pages left, then appends the remainder of the longer file at the end. Nothing is dropped, but a count mismatch usually means a sheet was double-fed during scanning.

When should I turn the reverse-second-file option off?

Turn it off when the second file is already in forward order — for example when your scanner software reversed the backs for you, or when you are weaving two ordinary documents together rather than fixing a duplex scan.

Does interleaving re-scan or recompress the page images?

No. Pages are copied between the two documents as objects, so the scanned images keep their exact original compression and resolution. Only the ordering changes.

Are my scans uploaded anywhere during interleaving?

No. Both PDFs are read, combined and rewritten by JavaScript running in your browser, and the merged file is saved straight to your device. No server ever receives the documents.

Related tools