fix(pdf): stop iOS inserting a blank page in downloaded PDF - #1
Merged
Conversation
The empty 2nd page (all templates) on iPhone wasn't content overflow — iOS WebKit inserts a blank sheet at `break-after: page`. Switch FramedDoc to `break-before: page` on every page after the first, which forces each subsequent page onto a fresh sheet from its own leading edge with no trailing blank. Verified on Chromium: traditional/floral 2 pages, royal 1 — no blanks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On iPhone (Safari/Chrome = WebKit), the downloaded PDF had an extra totally empty page between pages — across all templates, not just Floral.
Root cause
A totally empty page (not a partly-filled one) is not content overflow — iOS WebKit inserts a blank sheet at
break-after: page. This explains the whole sequence we saw while debugging on-device (4 → 3 → empty-page-3): each earlier change adjusted page height but the blank came from the break direction.Fix
FramedDocnow usesbreak-before: pageon every page after the first (instead ofbreak-after: pageon every page before the last). Each subsequent page is forced onto a fresh sheet from its own leading edge, so WebKit has no trailing break to pad with a blank.This builds on the earlier same-stack fixes (content-height pages + budgeting for iOS's non-removable margin) already on
main.Verification
npm run lintclean,npm test34/34 pass,next buildgreen.break-afterblank-page behavior.Note
Couldn't fully reproduce in emulation (headless always rendered correctly) — the blank is specific to the real iOS print engine, so on-device confirmation after merge/deploy is the final check.
🤖 Generated with Claude Code