Forum Moderators: not2easy

Message Too Old, No Replies

Printer Friendly printout problem

         

Br_Url

5:22 pm on Jun 5, 2008 (gmt 0)

10+ Year Member



Ok; here's the scenario:

I have taken over administering a website for a religious community and have modified the existing CSS file to include an @media print { } section that turns off all graphics and sidebars and just prints out black text on a white background within a 50 pixel margin on all sides.

doctype = XHTML 1.0 Transitional

problem:

Everything print previews fine and prints fine under Firefox 2.0.0.14 but under IE7, the second page of ANY printout or print preview from ANY webpage on that site has a huge left margin taking up a good 3/4 of the printed page. I did not write the initial stylesheet, I simply took the initial stylesheet, placed it inside the @media print { } statement, and did my modifications from there.

I must admit that I am a bit over my head with this, so I would appreciate any feedback

webfoo

12:22 am on Jun 8, 2008 (gmt 0)

10+ Year Member



A similar problem happened to me in IE7. I posted a message asking for help, but no one answered. I guess we're all alone ... in the dark .... with no one there ... and scary monsters ...

SuzyUK

3:51 am on Jun 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Boo!

and scary monsters ...
, you called ;)

Ok here's a couple guesses in the absence of some code to test,

1, the support of @media {} was never that good, I don't actually know the state of play with IE7 as I still use a separate print stylesheet call.. try that

i.e. make your main sheet <link rel {href..etc} media="screen, projection"> or <style type {etc} media="screen, projection">@import

then do another the same again only change the media to print and call a separate sheet using your print prefs in it..

this will mean a blank slate for the print sheet so it should need less overrides

does that help?

2. the step above might actually negate the need for this step depending on what your original "media" call was

still using your @media print {print rules} in the main sheet, make sure the media of the master sheet is "all" then, make sure there is no positioning, or floating remaining in the print part of your rules on the content you want displayed - e.g. if you're using

display: none;
on your sidebars and they're floated, there should be no need to still float the center content.. (if you're not using display: none; for the content you want hiding, that could also be part of the issue)

failing all that can either of you give some example code where it happens {we can fill up with foo text) but would need the Doctype and page skeleton

-Suzy

PS: Welcome to WebmasterWorld, Br_Url,

.. now back to my cave

Marshall

8:03 am on Jun 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not sure if this is any help, but I use an .asp print script that has comment tags in the <body> and the script pulls the tagged sections. The script itself has its own css so there is no relying on @imedia or link-rel. Don't know if you can run .asp, but I would suspect there is a .php version out there. Regardless, it works really well.

Marshall

swa66

12:20 pm on Jun 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your media type isn't set for the main sheet, you do not need to repeat all the CSS in the @print {} section, just issuing some display:none statements usually does most of the trick, as well as setting related margins and the like to 0.

Br_Url

5:14 pm on Jun 9, 2008 (gmt 0)

10+ Year Member



Thanks, all. I will try using a separate stylesheet. I would have included sample code but i am not sure where the problem is and its a 1,000+ line css file I inherited! I don't want any moderators jumping up and down on my head, ifyouknowwhatimean!

You guys have given me some ideas that I can pursue and I will see what I can come up with. and thanks also for the welcomd.