Alternate-Mix PDF — Interleave Odd and Even Pages
Interleave two PDFs — typically the odd and even pages from a single-sided scanner — into one correctly-ordered document. Browser-local via pdf-lib. Files never leave your device.
Frequently asked questions
- Why would I need to interleave two PDFs?
- Almost every single-sided sheet-feed scanner forces you into this workflow. The auto-document-feeder pulls the stack and produces a PDF of odd pages (1, 3, 5 …). You flip the stack, run it again, and get a second PDF of even pages — sometimes in natural order (2, 4, 6 …), sometimes reversed (last page first) depending on how you flipped. To rebuild the original two-sided document you need to weave the two PDFs back together: A1, B1, A2, B2, A3, B3 and so on. Manually splitting into single-page PDFs and dragging them into a merge tool works but takes 20 minutes for a 40-page contract. This tool does it in one click — pick two PDFs, choose forward or reverse for the even-pages file, click Combine, download the unified document.
- What's the difference between forward and reverse order?
- Forward (A1, B1, A2, B2 …) is correct when your even-pages PDF reads in natural order: page 2, then 4, then 6, and so on. This is what you get when you put the stack back face-up after the first pass and feed it through again. Reverse (A1, B(end), A2, B(end-1) …) is correct when you flipped the stack the other way and the even pages came out backwards — last page of the document first, second-to-last second, and so on. If you're not sure, run the tool both ways and check page two of the output. Page two should be the back side of page one of the original document. The wrong setting makes it obviously wrong on the very first interleave.
- What if one PDF has more pages than the other?
- The tool still produces output and warns you about the mismatch. It walks the longer PDF's page indices and emits A[i] then B[i] when both exist; when only one exists, it emits whichever is left. Common scenarios: the document had an odd total page count (so the even-pages pass is one shorter), the auto-feeder jammed and skipped a sheet, or the user picked the wrong file pair. The output keeps every page from both inputs — you'll see a small stranded page at the end where the longer PDF runs out of pairings. Inspect the result. If it looks wrong, re-scan the missing page on its own and use /merge to splice it in.
- Are my files uploaded to a server?
- No. Both PDFs stay in your browser. pdf-lib loads each file into memory, walks its pages, builds the interleaved output, and hands you a download URL — all local JavaScript. There is no upload step, no temporary copy on a server, nothing transmitted anywhere. This matters because alternate-mix is most often run on bank statements, signed contracts, medical records, and legal documents — exactly the document types you do not want to upload to a free online tool. Open DevTools and switch to the Network tab while you run the tool. You will see the page's code load, and possibly anonymous analytics events, but no request that carries either PDF when you click Combine.
- Will it preserve bookmarks, links, and form fields from the source PDFs?
- Page-level content is preserved — text, images, vector graphics, form fields rendered on each page. Document-level metadata that lives outside individual pages (bookmark trees, document outlines, the AcroForm catalog of interactive fields) is not carried across by pdf-lib's copyPages. For a scanned-document workflow this is rarely a problem because scanner output usually has no bookmarks or interactive forms in the first place. If your source PDFs do have document-level features you need to keep, run the interleaved output through /flatten-pdf or rebuild the bookmarks afterwards in a desktop tool like Acrobat or qpdf.
- Is there a page or file size limit?
- There's no hard limit baked into the tool — the practical limit is your browser's available memory and the time you're willing to wait. Two PDFs of 200 pages each (typical for a long contract or a multi-chapter manual) finish in a few seconds on a modern laptop. Two PDFs of 2,000 pages each will work but take longer and use a few hundred megabytes of RAM. If the page renderer reports an out-of-memory error, split each input into halves with /split, run alternate-mix on the halves separately, and merge the resulting files with /merge.
- What about scanners that produce a single PDF with mixed pages?
- If your scanner already produced one PDF with odds and evens in the wrong order — for example pages in 1, 3, 5, 4, 2 sequence — that's a different problem. /alternate-mix-pdf is for combining two separate PDFs. For reordering a single existing PDF, use /reorder-pdf-pages, drag the page thumbnails into the order you want, and download. If the source order is unreadable garbage (image-only PDF where you can't tell which page is which without OCR'ing first), run /pdf-to-text on the source first to identify pages by content, then reorder.
How alternate-mix works
- Upload your odd-pages PDF. This is the file your scanner produced on the first pass — pages 1, 3, 5, 7 and so on. It loads into the browser, pdf-lib counts the pages, and the file goes nowhere else.
- Upload your even-pages PDF. This is the file from the second pass — pages 2, 4, 6, 8. The order depends on how you flipped the stack: most automatic document feeders produce these in reverse (last even page first), but some keep natural order.
- Pick the order mode. Forward (A1, B1, A2, B2 …) when the even pages are in natural order. Reverse (A1, B(last), A2, B(last-1) …) when the even pages came out backwards. If unsure, run it both ways and check page two of the output — it should be the back of page one of the original.
- Click Combine. pdf-lib walks both page lists and writes the interleaved sequence to a new in-memory PDF. The output download link appears below the button.
- Download and verify. Open the file. Pages should now read 1, 2, 3, 4, 5, 6 — the original two-sided document reassembled. If the page count looks wrong (one stranded page at the end), the inputs had unequal counts; the warning above tells you which file was longer.
Why a separate tool, not just /merge?
The plain /merge tool concatenates: file A's pages then file B's pages. That gives you 1, 3, 5, 7, 2, 4, 6, 8 — useless for reading. To get 1, 2, 3, 4, 5, 6, 7, 8 you have to interleave: take one page from A, then one from B, then back to A, then back to B. Doing this manually in /merge would mean splitting each file into single-page PDFs first, which is a 5-minute job for a short document and a 30-minute job for a long contract. /alternate-mix-pdf does the interleave in one button press because the only configuration that varies is forward-versus-reverse for the even-pages file.
Sejda is the only mainstream tool that ships an alternate-mix mode under that name. iLovePDF, Smallpdf, and PDF24 all expect you to do the interleave manually inside their drag-and-drop UI. We took Sejda's pattern, kept the forward-and-reverse choice that matters for real scanner output, and skipped the upload step that defeats the privacy purpose for the document types this is most useful for.
Who this is for
Anyone with a sheet-feed simplex scanner trying to digitize two-sided documents. That's a lot of people: legal teams scanning contracts, accountants scanning bank statements, HR teams scanning signed offer letters, students scanning library books, archivists processing back-issue magazines. The pattern is always the same — feed the stack once, flip it, feed it again, and end up with two PDFs that need to be woven back together into one readable document.
India angle: a lot of small offices in India still run older multifunction printers with simplex-only ADFs because duplex models cost noticeably more. This tool is the missing piece between those cheaper scanners and a clean digital archive of two-sided originals — bank statements, GST invoices, court orders, property documents.
Edge cases the tool handles honestly
Mismatched page counts. If one PDF has 39 pages and the other has 40 (very common when the original document had an odd page total), the tool warns you and still produces a 79-page interleaved output with the longer PDF's last page sitting alone at the end. You can inspect and decide whether the stranded page is correct.
Empty file. If you accidentally upload a 0-page PDF (rare but happens when a scanner crashes mid-job), the tool refuses to combine and shows an error pointing at which slot was empty.
Encrypted PDFs. The tool loads PDFs in ignore-encryption mode for the page-count read, which works for most scanner output. If your source has a real password, run /unlock-pdf first, then come back here.
Form fields and bookmarks. pdf-lib's copyPages preserves visible page content but does not carry document-level outlines or AcroForm catalogs across. For scanner output this never matters; for source PDFs that already had bookmarks it does, and you'd want to rebuild the outline afterwards.
Large files. Hundreds of pages on each side is fine. Thousands of pages may exhaust browser memory; split with /split first, alternate-mix the halves, then /merge the results.
Privacy callout
Both files are read by your browser, processed in memory by pdf-lib, and offered back to you as a download. Nothing is uploaded. There is no server-side processing in this tool — open the Network tab in DevTools while you run a Combine and you'll see no outgoing PDF data. This matters more than usual for alternate-mix because the inputs are typically two-sided scanned documents: bank statements, signed contracts, lease agreements, scanned identity documents. Uploading those to a free online tool is a security and privacy hazard. Doing the interleave in your browser keeps every page on your device.
After you've combined
Two follow-up tools are usually relevant. /remove-pdf-metadata strips author, dates, and producer fields from the combined file — useful before sharing a contract or a confidential document. /compress shrinks the file size without re-OCR'ing or re-scanning, helpful when the interleaved output is large because both inputs were image-heavy. If you're handling a scanned document and want to make the text searchable, that needs an OCR step, which we have not shipped — a desktop tool with built-in OCR is the way through for now.