hotzu hotzu - 1 year ago 117
HTML Question

Chrome print preview error

I want to print a html page.
The html page is developed by me, this page can be printed with mozilla, ie.

In Chrome: when pressing CTRL+P it brings up the preview window, but it says: "Print preview failed", and i can't print anything.
In opera it doesn't brings up the print window, nor from pressing CTRL+P nor from Menu->Print, Safari prints a white page.

Do you have any ideas what could be wrong? What kind of error can cause this problem? Is there any error log for chrome, to figure out what is wrong?


I tried removing html elements, css scripts, javascripts, and i found out that one of my css file is blocking the print preview, i will go one, and will try to remove blocks from the css, i hope i can find this way where is the error.


No success... Is there a possibility, that the css is to large for the browser to compile it? the css has imports inside, i tried to remove them, but this doesn't resolved my problem... Any other suggestions?

I have the following:

<link rel="stylesheet" href="/css/style.default.css" type="text/css" media="all"/>
<link rel="stylesheet" href="/css/myStyle.css" type="text/css" media="all"/>
<link rel="stylesheet" href="/css/print.css" type="text/css" media="print"/>

If I comment the first include, or change the media to screen for style.default.css then the preview is generated, but with missing css rules.
The style.default.css is my global css, it has 17 other css imported into it this way:

@import url('jquery.ui.css');
@import ...

I have tried to comment the imports, and tried only with the css rules from that file. (If the error came from one of the imports, this should fix the problem), but this didn't fixed it, so i tried =the other way around, commenting the css rules, and try only with the imports, same result. Only success if i comment the whole file...

Any other suggestions? Somebody knows if chrome is logging somewhere such errors?

Answer Source

Finally i found the error. 2 css rules have blocked the browser from generating the preview:

min-height: 100%;
height: 100%;


position: fixed;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download