2

I have a asp web application. It has a print button with print.css stylesheet. The print.css is very basic and just sets divs having images to style display none.

We all have virtual machines with ie8 installed as the main browser. When I select "Print" button I see the page behaving as it should. The print out comes fine without any image or logos.

But for some stations with same browser ie8 it acts as if its ignoring the print.css completely and prints with all the logos and images.

I am very much confused and not getting ideas what to check for. Just wondering if anyone else had this problem earlier or just have ideas what to look for.

Thanks

Abbi
  • 607
  • 3
  • 12
  • 23
  • 1
    Have you changed the `print.css` recently or did this just start happening? Also can you post some sample HTML, perhaps to jsfiddle.net – Don Zacharias Feb 29 '12 at 17:24
  • as @don sayed: show us some link, else it's hard to say – Joergi Mar 06 '12 at 02:57
  • Is it possible the stations with the problem have a cache copy of the page and aren't downloading the print.css file? Or maybe a cached copy of the print.css file? – scott.korin Mar 06 '12 at 16:02
  • @scott: No thats not possible as the receipt shows whatever user enters in the new session. The receipt is showing all the user entered values so its not getting cached values. Also print.css hasn't changed at all its still the same so I dont think it will matter if they have a cached copy of that file – Abbi Mar 22 '12 at 16:52
  • @Don: I have added the code as comments to Chris's answer below. Thanks. – Abbi Mar 22 '12 at 16:56
  • @Joerg: I have added the code as comments to Chris's answer below. Thanks. – Abbi Mar 22 '12 at 16:56
  • Any news if it is working yet, Abbi? – Chris Mar 25 '12 at 20:42

1 Answers1

0

One thing you can try to add @media print in your stylesheet:

@media print CSS media types define the rules for different types of presentation media. The normal display uses @media screen rules; printing rules can be defined with defined @media print (from Wikipedia)

implement it like this:

/* stylesheet print.css */
@media print {
    #header, #main-nav, #footer, .page_header, ul#progress-bar { display: none; }
}
  • UPDATE: OK, this did not help...

well, if you use e.g. firebug (or any console where you can inspect the page in your browser) it will show you which css styles are actually applied to each element. In case you don't know it, Firebug is an extension available for firefox and safari, chrome (firebug light)... there may be others too, but it is a really helpful tool I use everyday.

So, another suggestion what you could try:

  • create as a test your print-page and only include the print.css (this really should work, actually)
  • open this page directly (without js forward) in your browser and try to print it... if that works, try to normally link to this print page without using js, if that is possible...
Chris
  • 3,756
  • 7
  • 35
  • 54
  • #header, #main-nav, #footer, .page_header, ul#progress-bar { display: none; } This is the code for print.css – Abbi Mar 15 '12 at 21:17
  • @Abbi: thx for the code, I edited the answer, hope it works for you – Chris Mar 16 '12 at 08:59
  • @Abbi: can you tell us how you open the pop up window and what's its code? – Chris Mar 22 '12 at 17:30
  • I do not use a pop up window. Previous page is doing a post to this page. I post to this page via a javascript in the previous page. The javascript is doing just this: document.form1.action = "receipts.asp"; document.form1.submit() – Abbi Mar 22 '12 at 19:53
  • @Abbi: ah, ok I see... do you use firebug or any other console? I am not sure, but it could possibly be, that the other stylesheets still apply to this page... did you implement the print.css below the others? so, first link to your-stylesheet.css, your-stylesheet2.css, print.css? I am sorry, I can just try to help you find out what could be the reason, so sorry if I can't give you a right answer just now. But we'll find it :) – Chris Mar 22 '12 at 20:37
  • Thanks Chris, I really appriciate your efforts to help me out here. Yes I do have 5,6 more css files being called before this print.css. The details of those links are in which I am including in my page. But I am not sure as to why can that be an issue as it behaves well on some stations. But I would like to hear your take on that. – Abbi Mar 22 '12 at 21:14