Skip to content

Commit 4afc737

Browse files
committed
print: RFC: Center when printing a PDF with smaller size than the output page.
This builds on top of #13100, but this changes printing behavior intentionally so I thought it was worth discussing separately, to improve the rendering on test-cases like the one in https://bugzil.la/1697778. This matches what e.g. Evince does when you print the PDF in there on an A4 printer. We use margins to center horizontally, and flex to center vertically. The reasoning for this is that it should have better browser support (though maybe pdf.js no longer supports browsers without flex support?) and it's just as simple.
1 parent eb92ed1 commit 4afc737

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

web/viewer.css

+9
Original file line numberDiff line numberDiff line change
@@ -1763,6 +1763,15 @@ html[dir="rtl"] #documentPropertiesOverlay .row > * {
17631763
max-height: 100%;
17641764
page-break-after: always;
17651765
page-break-inside: avoid;
1766+
1767+
/* If we're smaller than the page, center the canvas horizontally and
1768+
* vertically */
1769+
min-height: 100%;
1770+
display: flex;
1771+
flex-direction: column;
1772+
justify-content: center;
1773+
margin-left: auto;
1774+
margin-right: auto;
17661775
}
17671776
#printContainer canvas,
17681777
#printContainer img {

0 commit comments

Comments
 (0)