I am allowing my users to print but the output is way too large (I have to manually adjust to about 60% in the print dialog). I use a css media query (below) to control the content and have tried changing the font-size of the html, body{}
without any change to the output font size. Printing to Adobe PDF prints correctly
Any ideas what I am doing wrong?
My Print Link:
<a href="#" onclick="window.print(); return false;"></a>
My css:
@media print {
body * {
visibility: hidden;
}
.printme, .printme * {
visibility: visible;
}
.printme {
position: absolute;
left: 0;
top: 0;
}
.printme, .printme:last-child {
page-break-after: avoid;
}
.display-none-on, .display-none-on * {
display: none !important;
}
html, body {
height: auto;
font-size: 12pt; /* changing to 10pt has no impact */
}
}
Finally figured this out and there were multiple causes. The main thing is that I needed to also set the font-size for the div that contained the text. In the main css, I have body font-size set to 62.5% and the div font-size set to 130%. When I set the body font-size for @media print{} to 12pt, it continued to use the 130% div setting and so printed very large.
I believe my efforts to adjust the font-size via changing the body font-size were flawed because I minify my css and probably forgot to minify after each change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With