Skip to content
DevToolKit

PDF Alternate Page Mix

Interleave pages from two PDF documents with configurable patterns. Combine front and back scans from single-sided scanners into properly ordered duplex output.

pdf

Drop PDF A here

Front-side pages

pdf

Drop PDF B here

Back-side pages

Processed locally
Processed locally
Was this tool helpful?

How to Use

Combine pages from two PDFs into a single interleaved document in five steps:

  1. Upload PDF A — Drag and drop or click the left dropzone to load the first PDF. For duplex scanning, this is your front-side scan containing odd-numbered pages (1, 3, 5...).
  2. Upload PDF B — Load the second PDF in the right dropzone. For duplex scanning, this is your back-side scan. The page count for each file is displayed automatically.
  3. Configure the mix — Select a preset pattern (1:1, 2:1, or 1:2) or enter custom values. Enable "Reverse PDF B" if you scanned back sides in reverse order, which is the default duplex scanner workflow.
  4. Review the sequence preview — A visual strip of colored blocks shows the resulting page order. Blue blocks represent pages from PDF A and red blocks represent pages from PDF B, each labeled with its source page number.
  5. Click "Mix Pages" — The tool creates a new PDF with pages interleaved according to your settings. Download the result and verify the page order in any PDF viewer.

Choose "Stop at shorter" if both PDFs should contribute equally, or "Continue with remaining" to append leftover pages from the longer document after interleaving completes.

About This Tool

Page interleaving is the process of merging two separate page sequences into a single document by alternating between them according to a defined pattern. Unlike concatenation (appending one document after another), interleaving produces a result where pages from both sources appear in an interwoven order. The most common pattern is 1:1 alternation — take one page from source A, then one page from source B, repeat — but other ratios like 2:1 or 1:3 are useful for specialized document assembly workflows.

This tool uses pdf-lib, a JavaScript library that operates on PDF structures at the object level. When interleaving, pdf-lib parses both source documents, creates a new empty PDF, and copies page references from each source in the specified order. The copy operation transfers complete page dictionaries — content streams, resource dictionaries, fonts, images, and annotations — without decompressing or re-encoding any data. This preserves text searchability, vector sharpness, and font fidelity byte-for-byte.

The "Reverse PDF B" feature addresses the most common interleaving scenario: combining front-side and back-side scans from a single-sided scanner. When you scan a double-sided document on a flatbed or ADF scanner that only captures one side, the typical workflow is: (1) scan all front sides in order, producing pages 1, 3, 5, 7...; (2) flip the paper stack and scan all back sides, which naturally produces pages 8, 6, 4, 2 (reverse order because the stack was flipped). Without reversal, naive 1:1 interleaving would produce 1, 8, 3, 6, 5, 4, 7, 2 — completely wrong. Enabling "Reverse PDF B" flips the back-side sequence to 2, 4, 6, 8 before interleaving, producing the correct final order: 1, 2, 3, 4, 5, 6, 7, 8.

The unequal-length handling controls what happens when one source document has fewer pages than the other. In "Stop at shorter" mode, the tool stops producing output as soon as either source is exhausted, which is useful when you know both sources should have matching page counts and any excess indicates an error. In "Continue with remaining" mode, leftover pages from the longer document are appended to the end, which is the correct behavior for documents where one side genuinely has fewer pages — for example, a 15-page document has 8 front sides but only 7 back sides.

Custom mix patterns extend the tool beyond simple alternation. A 2:1 pattern takes two consecutive pages from source A then one from source B, which is useful for workflows like combining a main document (two pages per section) with single-page separator sheets. A 1:3 pattern inserts one page from source A between every three pages from source B. The pattern repeats cyclically until one or both sources are exhausted.

Why Use This Tool

Page interleaving addresses several practical document management scenarios:

  • Duplex scan reconstruction — The primary use case. Organizations that scan double-sided documents on single-sided scanners need to combine front-side and back-side scan files into correctly ordered documents. This affects law firms processing legal exhibits, medical offices digitizing patient records, accounting departments archiving invoices, and anyone scanning contracts or correspondence.
  • Exam or form assembly — Educational institutions combine question sheets with answer keys by interleaving them. A professor can maintain separate PDFs for questions and solutions, then interleave them to produce a combined reference document.
  • Translation alignment — Bilingual document production often involves interleaving the original language pages with their translated counterparts, producing a side-by-side reference where each original page is immediately followed by its translation.
  • Document versioning — Legal and editorial workflows sometimes require interleaving two versions of a document (original and revised) to facilitate page-by-page comparison during review meetings.
  • Print preparation — Some printing workflows require specific page ordering that differs from the logical reading order. Interleaving can arrange pages for booklet printing, Z-fold layouts, or other specialized imposition schemes.

Processing both PDF files locally in your browser eliminates the privacy risk of uploading sensitive documents to cloud-based services. Scanned documents frequently contain personally identifiable information, financial data, medical records, or privileged legal materials that should never be transmitted to third-party servers. This tool guarantees that your document data remains on your device throughout the entire interleaving process.

FAQ

How does the duplex fix (Reverse PDF B) option work?
When scanning double-sided documents on a single-sided scanner, you scan all front sides first (1, 3, 5...) then flip the stack and scan all back sides. The back-side stack comes out in reverse order (10, 8, 6...). Enabling Reverse PDF B flips the back-side page order before interleaving, producing the correct final sequence: 1, 2, 3, 4, 5...
What happens when the two PDFs have different page counts?
You choose the behavior: 'Stop at shorter' ends output when either PDF runs out of pages, while 'Continue with remaining' appends leftover pages from the longer document after interleaving finishes.
Can I interleave in patterns other than 1:1?
Yes. The mix pattern controls how many pages are taken from each PDF per cycle. A 2:1 pattern takes two pages from PDF A then one from PDF B. Custom patterns like 3:2 are also supported for specialized workflows.
Is my PDF uploaded to a server?
No. Both PDF files are processed entirely in your browser using the pdf-lib JavaScript library. Your documents never leave your device, making this tool safe for confidential and sensitive files.
Does interleaving affect the quality or formatting of pages?
No. The tool copies page references from the source documents into a new PDF without re-encoding any content. Text, images, fonts, annotations, and vector graphics are preserved exactly as they appear in the originals.