I have a Web page with a diagram that is meant to be fixed in size to width:1660px;height:480px;
using CSS. The page (am I allowed to link to it?) displays properly in the browser, but when printing in Google Chrome (I haven't tested other browsers yet), it is too big horizontally to fit in a single page. How do I scale the HTML to fit one printed page?
Here's what the output might look like (Firefox 60):
I have tried messing around with media queries such as this:
@media print
{
@page
{
size: 297mm 210mm; /* landscape */
/* you can also specify margins here: */
margin: 250mm;
margin-right: 450mm; /* for compatibility with both A4 and Letter */
}
}
But I cannot notice any effect in the print preview.
[edit]
Internet Explorer 11 seems to be able to scale the page automatically in the print dialog. I don't know why Google Chrome can't do this as well.
[edit]
I tried transforming the page too. However the printed result is very different in Chrome vs IE11.
@media print
{
html
{
transform: scale(0.5);transform-origin: 0 0;
}
}
Next, I tried zooming the page. This worked pretty well, but I don't know if it only affects Chrome or if it affects IE and Firefox as well.
@media print
{
html
{
zoom: 50%;
}
}
In either case, there's no way for the user to disable the effect when using CSS, unless you create new JavaScript controls too.
@media print {.diagram{ set new size } ... }
html
orbody
?