Skip to content

feat: add alternate PDF operation - #218

Merged
mithun-srinivas merged 2 commits into
mithun-srinivas:mainfrom
Mithurn:feat/alternate-pdf
Sep 12, 2026
Merged

mithun-srinivas merged 2 commits into
mithun-srinivas:mainfrom
Mithurn:feat/alternate-pdf

Conversation

@Mithurn

@Mithurn Mithurn commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #200

What changed

  • Adds an Alternate PDFs operation that interleaves pages from two or more PDFs (A1, B1, A2, B2, …).
  • Adds a Reverse the second file option for backs scanned last-page-first. Leftover pages from a longer file are appended.
  • Self-contained plugin at src/operations/alternate-pdf/, plus a shuffle glyph in Icon.jsx. No new dependencies.

Acceptance criteria (from the issue)

  • Pages from the inputs are interleaved in order into one PDF
  • A reverse-second-file option works for double-sided scans
  • Runs fully offline

Proof

9 unit tests and a Playwright e2e spec; npm run build and npm run lint pass.

1-tool-ready

Output page order. Green pages came from the first file, blue from the second, so the alternating colours show the interleave and 1-6 shows the reverse option correcting the backs.

3-page-order

Network tab on the production build: downloading the result makes zero requests.

4-network

@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

@Mithurn is attempting to deploy a commit to the Mithun Srinivas' projects Team on Vercel.

A member of the Team first needs to authorize it.

Interleave pages from two or more PDFs: A1, B1, A2, B2, and so on. An
option reverses the second file for backs scanned last-page-first. When
one file is shorter, leftover pages from the others are appended.

Page order is planned by a pure function so it can be tested without
building PDFs, and reading and copying share one monotonic progress bar.
Nothing imports it, and the extra non-component export disabled Fast
Refresh for every consumer of Icon.jsx.
@mithun-srinivas

Copy link
Copy Markdown
Owner

Really well-rounded PR @Mithurn, thank you. The interleave plan handles two or more files and appends leftovers from the longer one, the reverse-second option covers duplex scans, and using copyPages keeps the pages as vectors so text stays selectable. Shipping unit tests plus an e2e spec and the zero-network proof is exactly the standard we love to see.

Meets every criterion on #200 and all checks are green. Merging now.

One tiny thing for next time, no action needed here: the Icon.jsx change also dropped the unused iconNames export, which is unrelated to this feature. It is dead code so no harm done, just easier to review when unrelated cleanups ride in their own PR. Thanks again!

@mithun-srinivas
mithun-srinivas merged commit f584cb9 into mithun-srinivas:main Sep 12, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alternate & Mix PDFs (interleave pages of two files)

2 participants