Skip to content

fix(export): give an exported file the page margin on screen too - #1034

Merged
PathGao merged 2 commits into
masterfrom
fix-export-screen-margin
Oct 26, 2026
Merged

PathGao merged 2 commits into
masterfrom
fix-export-screen-margin

Conversation

@PathGao

@PathGao PathGao commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #1033, whose last two commits landed after the merge.

An exported file used 40px on screen and the 1cm print margin on paper. One --page-margin in styles.css (1cm, which CSS draws as 37.8px on screen) is now the padding of the app's PDF, of a printed export and of an exported file on screen, so the file keeps its shape when printed. The live preview's own padding is unchanged.

The margin tests #1033 added could not fail: one reused jsdom document kept the previous page's computed style, so both sides of each comparison read the same value, and jsdom computes a var() padding as 0. Each page now renders in its own frame, var() is resolved against the root, and a zero margin fails outright.

Verified: scripts/export.spec.ts fails with the print display rule removed, with 40px back on paper, with 40px on screen, and with --page-margin missing. Full node/vitest suites and svelte-check green. A built export in headless Chrome shows the same 1cm margin on screen and on paper.

The exported file used 40px on screen and the print margin on paper. Both
now come from one --page-margin (1cm, 37.8px on screen), so the file keeps
its shape when printed. The live preview's own padding is unchanged.
One reused jsdom document kept the computed style of the previous page, so
the margin comparisons read the same value on both sides and could not fail.
Each page now gets its own frame, var() is resolved against the root, and a
zero margin fails outright.
@PathGao
PathGao merged commit ea8a432 into master Oct 26, 2026
4 checks passed
@PathGao
PathGao deleted the fix-export-screen-margin branch October 26, 2026 13:18
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