diff --git a/client/src/components/Studio/printSheets.ts b/client/src/components/Studio/printSheets.ts index 215fbb29b..066c9b818 100644 --- a/client/src/components/Studio/printSheets.ts +++ b/client/src/components/Studio/printSheets.ts @@ -161,9 +161,11 @@ ${singleRule(input)} .bx-book { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px 0; } .bx-sheet { box-shadow: 0 2px 12px rgba(0,0,0,0.35); } @media print { - html, body { background: ${PAPER}; } + /* Undo the copied app scroll bounds so the printer can paginate the whole book. */ + html, body { height: auto; overflow: visible; background: ${PAPER}; } .bx-book { display: block; gap: 0; padding: 0; } - .bx-sheet { box-shadow: none; } + /* A clipped half-spread must not widen the sheet when Chromium fits it to paper. */ + .bx-sheet { contain: strict; box-shadow: none; } /* Photographs are the point. Without this the browser drops backgrounds and colour-managed fills to save toner, which is right for a web page and wrong for a photo book. */ diff --git a/client/tests/unit/studio/printSheets.test.ts b/client/tests/unit/studio/printSheets.test.ts index 3f4b13537..c2fcaa187 100644 --- a/client/tests/unit/studio/printSheets.test.ts +++ b/client/tests/unit/studio/printSheets.test.ts @@ -46,6 +46,14 @@ describe('the document', () => { expect(frame().srcdoc).toContain('@page { size: 224mm 303mm; margin: 0; }') }) + it('lets clipped spreads paginate at their fixed sheet size (#3275)', () => { + open() + const html = frame().srcdoc + const printBlock = html.slice(html.lastIndexOf('@media print')) + expect(printBlock).toMatch(/html, body\s*\{[^}]*height: auto;[^}]*overflow: visible;/) + expect(printBlock).toMatch(/\.bx-sheet\s*\{[^}]*contain: strict;/) + }) + /* * Hyphenation is off in every browser until the language is known, so a * heading the editor had broken as "Lorem ip-sum" printed unbroken, ran past