Repository navigation
fix(html): print one page box to a sheet - #1197
Merged
Merged
Conversation
The pdf view, slides, drawing pages and text pages with margins printed the viewer as it is on screen. The grey backdrop and the gaps printed, the pages broke across sheets, and a landscape page shrank onto a portrait sheet. In print, the page column now drops the backdrop, the gaps and the shadows, and it breaks after each page box. An `@page` rule gives the sheet the size of the page, and a pdf names one page for each size. A text page puts its margins on the sheet, so text that runs past a sheet keeps them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KNpfqA2jL1iVM1Wirf7njH
The dark style came after the print rules, so a dark render printed a black backdrop, a shadow and a dark page, or light-grey text on white paper. Gate the dark style on screen, so that a print always uses the light style. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5yx1nDeVcNX3BxqK1WpJz
andiwand
force-pushed
the
fix/print-page-boxes
branch
from
October 10, 2026 08:52
d924eb9 to
83fab80
Compare
andiwand
added a commit
that referenced
this pull request
Oct 10, 2026
The output now has the print rules of #1197, and the whole-sheet reads of formulas that do not parse from #1193. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5yx1nDeVcNX3BxqK1WpJz
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.
A user reported that a pdf printed from the mobile apps has the wrong layout. Both apps print every document through the web view, a pdf too: the Android
PdfDocumentAdapteroverload has no caller. So what prints is our HTML, and the fixed-page views had no print rules.Before
Chrome
--print-to-pdfof the current output:#525659), the 16px gaps and the shadows print.Casio_WVA-M650-7AJF.pdfprinted on 10 sheets, each with parts of two pages. Slides do the same: 6 slides ofstyle-various-1.odpon 4 sheets.Change
document.css:@media printtakes the backdrop, the gaps, the padding and the shadows off.odr-pagesand.odr-page-outer, and breaks after each page box.document.cpp: a paged view writes an@pagerule with the size of the first page. A text page puts its margins on the sheet and drops them from.odr-page-inner, so text that runs past a sheet keeps them.pdf_file.cpp: the same print rules for.d/.p. Each page box gets a named@pagefor its size, so a pdf that mixes portrait and landscape pages prints each sheet in its own orientation..pgetscontent-visibility:visiblein print, because WebKit prints an off-screencontent-visibility:autopage blank.frontend.cpp: the dark style is gated onscreen. Before, a dark render printed a black backdrop, a shadow and a dark page, or light-grey text on white paper. Now a print always uses the light style.Verification
I printed the output of 13 corpus files (pdf, odp, pptx, key, odg, odt, docx, md, xlsx). I used Chrome through CDP
Page.printToPDFin three ways: with the CSS page size, and with the paper forced to A4 and to Letter, the way the Android print framework picks it. I also used WebKit throughWKWebView.printOperationon macOS with A4 and Letter, as the nearest stand-in for the iOS print path.@pagesize and only shrinks to fit the paper width. So an A4 page on Letter paper still breaks over two sheets in WebKit, as before. CSS cannot fix this: in WebKit print layoutvhis the height of the window, not of the paper. On iOS, the app can choose the paper withUIPrintInteractionControllerDelegate.printInteractionController(_:choosePaper:).I did not test on a phone.
Reference output
Every paged and every pdf output changes: a new
<style>in the head, and aqclass on each pdf page. Socompare-htmlneeds a reference-output update. That update is not in this PR yet.