5

I'm using classic javascript window.print() function that is bound to a button to print a page. When I use it the first time after the page loads, it loads the background and the CSS but doesn't load the text for some reason.

When I close the Print Preview (not reloading the page) and click the button again, it loads the missing text completely. This only happens on Chrome, while in Firefox it loads the text on first try without any problems.

I've tried using setTimeout, and window.on('load'...) functions, but didnt help. I'm using a separate CSS file for page printing. What can be the cause of this problem?

purfufna
  • 101
  • 1
  • 6
  • I won't add it as an answer as I'm not certain it will solve your problem but try using the `easy-print` JS library here: https://github.com/M1ke/easy-print (there's an extra version for jQuery too). It uses an `iframe` to improve loading of the print stylesheet on a link. If this works for you let me know and I'll add it as an actual answer. – M1ke Nov 26 '14 at 12:31

2 Answers2

6

Had quite same issue. (no printing on first try on windows chrome browser)

Solved it by removing

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300italic,600);

from print.css and take another font for printing.

André Kelling
  • 1,575
  • 16
  • 23
  • that actually did it :D – purfufna Dec 25 '14 at 14:41
  • So, I'm actually running into the same issue, but Open Sans is directly in the CSS and not imported like this but I'm still observing the same behavior. If I take it out, it's fine. if I keep it in, it doesn't load. Do we know why it's causing this issue? – jvdub Oct 30 '15 at 18:46
-2

"This only happens on Chrome, while in Firefox it loads the text on first try without any problems."

May be your chrome browser have some problem.. Once try re-installing the browser.. It may solve your problem...

  • The Chrome behaves normally when I try to Print Preview any page on the web. So I'm positive that its not the problem about my browser installation :) – purfufna Nov 26 '14 at 12:39