When you scan a stack of double-sided pages through an automatic document feeder (ADF), the scanner runs two passes: all front sides first, all back sides second. You end up with two separate PDF files instead of one correctly ordered document. Most online tools have no idea how to handle this structure. The duplex scan organizer in pdfredX does exactly that β entirely in your browser, with no file ever leaving your device.
Step 01. Loading Your Files
Open pdfredX and drag both PDF files into the upload zone β or browse to them through your file picker. Load them in the right order: front side first (odd pages, face-up stack), back side second (even pages, reverse stack). The order matters β it determines which file the algorithm treats as the starting point.
After upload, the gallery immediately applies color coding: a green bar on cards marks front-side pages, a blue bar marks back-side pages. This isn't decoration. It reflects the internal keys pdfSrcKey: 'duplex:front:...' and 'duplex:back:...' inside the items[] array β the same keys the interleaving algorithm reads during assembly. If the colors are swapped, the files were loaded in the wrong order; remove them and reload.
Step 02. Configuring the Duplex Settings
Click the Duplex Scan button in the toolbar. This opens the #DM side panel with three controls.
File assignment. Two dropdowns: Front and Back. If you loaded the files in the right order, the assignment fills in automatically based on load sequence. If not β reassign manually, it takes five seconds.
Reverse back (dmReverseBack). The most critical toggle. Most ADFs flip the paper stack after the first pass β back pages are scanned in reverse order: the last sheet comes out first. Without accounting for this, the interleaving breaks: Frontβ β Backβ
β Frontβ β Backβ instead of Frontβ β Backβ β Frontβ β Backβ.
With reverse enabled, the algorithm reads the back-side array right to left: index backLen - 1 - i instead of i. One line of math, but it's the difference between a garbage document and a correctly ordered one. How to tell if your scanner needs it: enable the toggle and scroll through the gallery preview. If page 2 is now the back side of page 1 β you're done. If not β flip the toggle.
Live order preview. The gallery updates the card order in real time as you change settings. You can scroll all pages and verify the interleaving before committing to the final assembly.
Step 03. Assembly and Export
Click Apply. The algorithm rebuilds the items[] array in milliseconds β this is a pure index-reordering operation, no re-rendering involved. The gallery immediately reflects the final order: Frontβ / Backβ / Frontβ / Backβ / ...
Quick start from the landing page. If you arrived at pdfredX through the Duplex Scan feature page, the browser has already saved you a step. js/features-landing.js writes openTool=duplex to sessionStorage and redirects to the main app. On load, the application reads this parameter and automatically opens the duplex panel β no need to hunt for the button in the toolbar. Just drop your files and configure the reverse toggle.
Export. Click Download PDF. jsPDF 2.5.1 iterates over the reordered items[] array: for each page it calls addImage(editUrl, ...) and auto-detects A4 orientation from the image proportions. The file is assembled entirely in browser memory and downloaded directly β no server queue, no waiting for a remote response.
How It Works Under the Hood
Each uploaded PDF is rendered page by page through PDF.js 3.11.174. Every page becomes a rasterized dataURL in Canvas and is stored in the items[] array with a source key. Two PDFs produce two separate arrays with distinct pdfSrcKey values.
During duplex assembly, nothing is re-rendered. The algorithm builds a new index array: alternating items[i] from the front array and items[j] from the back array, where j = i or j = backLen - 1 - i depending on the dmReverseBack flag. The entire operation is JavaScript array manipulation β no heavy render pipeline. On a 200-page document this takes under 100 milliseconds.
Known Limitations
Rasterized output only. PDF.js renders pages to Canvas, so the output is raster images, not vector text. Text in the final PDF can't be selected as text β it's part of the image layer. If you need a live text layer, use the Area OCR tool on the relevant pages after assembly.
Mobile performance. Documents over 80β100 pages render noticeably slower on low-end phones: PDF.js keeps every page in memory as ImageData. On desktop this is nearly imperceptible.
Mismatched scan resolution. If front and back were scanned at different DPI or orientation, the interleaving will work correctly but the visual result will be inconsistent. Use the rotate tool to align page orientations before running the duplex assembly.
Browser memory cap. Practical limit is around 200β300 pages per tab depending on available RAM. Beyond that, Chrome begins evicting cache, and re-rendering slows down the assembly.
If you scanned a book in spread mode β where each page contains two leaves β that's a different workflow. We have a separate guide for it: Split Book Spread PDF into Two Pages.
Try it now β pdfredx.com, no sign-up, your files stay on your device.
