I would like a different font-face for print than for screen. Unfortunately Google Chrome Print Preview (works on other browsers) won't load the font-face and won't show the text. But if you try it a second time, the font-face is loaded and then, Google Chrome Print Preview will show the text!
Here is a fiddle on which you can reproduce the problem. (nb: on the fiddle the font url does not exist, but at least the preview should show the text as 'serif').
Is there a better solution than forcing the pre-loading of the print font-face for all @media?
The problems occurs on all versions of Google Chrome <= 53.
I used this code:
@media only print {
@font-face {
font-family: "Computer Modern";
src: url('/fonts/cm/cmunrm.otf');
font-weight: normal;
font-style: normal;
}
body {
font-family: "Computer Modern", serif;
}
}
https://jsfiddle.net/72bsf1n0/
Or, use a keyboard shortcut: Windows & Linux: Ctrl + p. Mac: ⌘ + p.
As of Chrome 48+, you can access the print preview via the following steps: Open dev tools – Ctrl/Cmd + Shift + I or right click on the page and choose 'Inspect'. Hit Esc to open the additional drawer.
Follow below solution steps to resolve loading print preview take long time issue by disabling print preview function in Google Chrome. Step 1: Open regedit. Step 2: Go to Computer\HKEY_CURRENT_USER\SOFTWARE\Policies\Google\Chrome or Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome
Step 1: Open regedit. Step 2: Go to Computer\HKEY_CURRENT_USER\SOFTWARE\Policies\Google\Chrome or Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome Step 3: Add DisablePrintPreview REG_DWORD with value 1. Step 4: Restart Google Chrome. Remark: You can use the group policy to push down this key to all user PC. Step 1: Open Terminal.
If your Chromebook can’t load the print preview, restart your laptop, printer, and router. Additionally, remove and set up the printer again. If the issue persists, clear your Chrome cache, and disable your extensions. You can also reset your browser to default settings.
@media print worked for firefox and when I tried using chrome it is a mess. Lots mentioned use @media screen and (-webkit-min-device-pixel-ratio:0) which I did and chrome doesn’t read all selector and the properties. for example I have @media screen and (-webkit-min-device-pixel-ratio:0) { a [href]:after { content: none !important; } }
Just found this question via Google after we had just experienced the same problem. Sad to see 11 months gone by with no answer, so perhaps this will help you and others.
Chrome seems to load the custom font 'on-demand'. So, if the font isn't already used on the page, your first 'Print Preview' fails to have it yet, subsequent ones will have it. Likely a timing issue there.
One solution would be to make sure you also use the print font on the regular version of the page.
@font-face {
font-family: "Computer Modern";
src: url('/fonts/cm/cmunrm.otf');
font-weight: normal;
font-style: normal;
}
@media only print {
body {
font-family: "Computer Modern", serif;
}
}
.printfont {
font-family: "Computer Modern", serif;
}
https://jsfiddle.net/72bsf1n0/8/
There is a issue for this here https://bugs.chromium.org/p/chromium/issues/detail?id=284840
For now you need to sure there is printed font rendered before using print and you render at least 1 character from every language group you want to print:
For now I add characters from Latin extended
<div class="chrome-font-fix">sš<b>sš</b><i>sš</i></div>
with invisible style
.chrome-font-fix {
position: absolute;
visibility: hidden;
}
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