Skip to content

fix(html): print a text page with a page frame whole - #1199

Merged
andiwand merged 1 commit into
mainfrom
fix/print-page-anchored-frames
Oct 10, 2026
Merged

andiwand merged 1 commit into
mainfrom
fix/print-page-anchored-frames

Conversation

@andiwand

@andiwand andiwand commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

#1197 puts the margins of a text page on the printed sheet (@page), so text that runs past one sheet keeps its margins. But a frame anchored to the page has a position from the page edge (left:2cm;top:1cm in .odr-page-outer). In print, the page box now begins at the margin, so every page frame moves by the left and top margins.

Before

I printed the 79 changed full-document pages of the public reference output with Chrome (CDP Page.printToPDF) and compared the result with the LibreOffice PDF export of the originals. Only one page got worse than before #1197: odt/Din_5008_business_letter.ott. Its top margin is 9.85 cm. The header picture and the address blocks moved down into the body text, and the footer went to a second sheet.

Change

A text page with a frame anchored to the page is a fixed layout, like a letter template. It prints as a slide prints: @page{size:…;margin:0}, with the margins kept in the page box. Text without such a frame keeps the #1197 behavior.

Verification

  • html.a_text_page_with_a_frame_on_the_page_prints_whole: a page anchor gives @page{margin:0}, and a paragraph anchor keeps the margins on the sheet.
  • The Din letter prints on one sheet, with the CSS page size and on forced A4. It matches the LibreOffice export.
  • A prototype of the earlier alternative (@page:first{margin-top:0}, side margins in the box) still pushed the footer to a second sheet, so I did not use it.
  • The html and PdfFile tests pass (112 tests).

Reference output

In the public corpus, only odt/Din_5008_business_letter.ott/document.html changes. The private corpus may have more. I will update the reference output once, after this PR and #1198 have landed.

A frame anchored to the page stands off the page edge. The print rules put
the margins of a text page on the sheet, so the page box began at the margin
and every page frame moved by the left and top margins. In a letter template
the header ran into the body and the footer went to a second sheet. Print
such a page whole, with its margins in the box, as a slide prints.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S5yx1nDeVcNX3BxqK1WpJz
@andiwand
andiwand force-pushed the fix/print-page-anchored-frames branch from c98b540 to a637561 Compare October 10, 2026 09:22
@andiwand
andiwand merged commit e770fa7 into main Oct 10, 2026
25 checks passed
@andiwand
andiwand deleted the fix/print-page-anchored-frames branch October 10, 2026 09:27
andiwand added a commit that referenced this pull request Oct 10, 2026
…paces

The output now prints a text page with a page frame whole (#1199), and reads
a space before an ods function's parenthesis (#1198).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S5yx1nDeVcNX3BxqK1WpJz
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