Deck PDF: override the global single-sheet print lock on html/body

Verified via headless Chrome + CDP: the live app rendered only 1 PDF
page with the slide canvas at ~56% page width and the right side
white. Minimal CSS repros produced 3 pages correctly, so the bug
was in interaction with the rest of the app's stylesheet.

Root cause — base print stylesheet (line 2455):

  @media print {
    html, body {
      width: var(--sheet-w) !important;
      height: var(--sheet-h) !important;
      overflow: hidden !important;
    }
  }

Designed for single-sheet prints (cover / disc / jewel — one
physical sheet per design). For deck PDF that's wrong:

- width / height pin body to the cover-template sheet dims (the
  --sheet-w / --sheet-h variables don't get reset for deck mode),
  so 20in × 11.25in deck pages get clipped to ~11in × 8.5in. The
  canvas previewing 1920×1080 inside a body locked to a smaller
  width ends up as a square (height-constrained), filling only
  ~56% of the actual PDF page width.
- overflow: hidden kills the multi-page break-after flow — the
  second and third .deckPrintPage divs overflow body's height
  and just get clipped instead of paginated.

Fix: deck PDF stylesheet now also overrides html/body to
width: auto; height: auto; overflow: visible so the body
expands to hold every .deckPrintPage and break-after works.

Verified end-to-end with a CDP-driven export of a 3-slide deck:
- pdfinfo: 3 pages, 1440x810 pts (20x11.25in)
- pdftoppm + visual inspection: each page is 1920x1080 fill,
  correct background colour, slide text centred at expected
  position. Yellow slide ONE / blue slide TWO / green slide THREE
  all render.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.7 committed 2026-05-26 15:02:12 -04:00
1 parent f6d0394735
commit ca6a150ff1
1 file changed
+11
+11
View File
@@ -14614,6 +14614,17 @@
styleEl.textContent = `
@media print {
@page { size: ${fmt(pageW)}in ${fmt(pageH)}in; margin: 0; }
/* The base print stylesheet locks html / body to the cover-
template sheet dims with overflow:hidden so single-sheet
prints don't run off the page. Override that for the deck
exporter — we need the body to expand to hold every
.deckPrintPage and let break-after page-break properly. */
html, body {
width: auto !important; height: auto !important;
overflow: visible !important;
margin: 0 !important; padding: 0 !important;
background: #fff !important;
}
body > *:not(#deckPrintContainer) { display: none !important; }
#deckPrintContainer { position: static !important; left: 0 !important; top: 0 !important; display: block !important; }
.deckPrintPage {