Skip to content

fix(pdf): stop iOS inserting a blank page in downloaded PDF - #1

Merged
pythonsst merged 1 commit into
mainfrom
fix/ios-pdf-blank-page
Jun 27, 2026
Merged

fix(pdf): stop iOS inserting a blank page in downloaded PDF#1
pythonsst merged 1 commit into
mainfrom
fix/ios-pdf-blank-page

Conversation

@pythonsst

Copy link
Copy Markdown
Owner

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

FramedDoc now uses break-before: page on every page after the first (instead of break-after: page on 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 lint clean, npm test 34/34 pass, next build green.
  • Headless Chromium PDF page counts: traditional 2, floral 2, royal 1 — no blank pages.
  • iOS itself can't be tested from CI; this directly targets the known WebKit break-after blank-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

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>
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
snapbiodata Ready Ready Preview, Comment Jun 27, 2026 9:41pm

@pythonsst
pythonsst merged commit 61a7f66 into main Jun 27, 2026
3 checks passed
@pythonsst
pythonsst deleted the fix/ios-pdf-blank-page branch June 27, 2026 21:44
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.

1 participant