mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 00:43:15 +00:00
fix(studio): paginate PDF exports at full sheet size
Remove the app scroll bounds from the print layout so every sheet paginates. Contain each sheet so clipped spreads cannot alter its printed scale. Closes #3275
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user