Click to See Complete Forum and Search --> : is Print CSS being used


mcgrailm
07-28-2008, 12:07 PM
hello,

I've been trying to figure out if there is some way for me do determine if the Print CSS in use. What I want to do is turn off my flash content when printing. Currently when the user does NOT have flash I show them a static object in the same div. If I can have a javascript that checks to see if the print css is in use then maybe i can figure out how to turn off the flash content.

thanks for your help
mcgrailm

Declan1991
07-28-2008, 12:15 PM
The print CSS sheet will only be used when the page is being printed if you are specifying the media type. It will never be used on the actual page.

How are you adding the Flash to the page?

mcgrailm
07-28-2008, 12:21 PM
right but it does get used when the user prints ?

I add the flash using SWFObject

thanks again

mm

Declan1991
07-28-2008, 12:24 PM
It will always be used when the user prints.

mcgrailm
07-28-2008, 12:36 PM
I think that's my point I want javascript to detect when the page is being rendered using the print css so I that it can determine when to include the SWF object

thanks
mm

Declan1991
07-28-2008, 12:58 PM
Off the top of my head Flash doesn't print at all, but I could be wrong. Thing is, you don't need to use JavaScript for this at all. CSS is perfectly capable of doing it as far as I know. Have you an actual page yet?

mcgrailm
07-28-2008, 01:14 PM
indeed you are correct my friend; Flash does NOT print. However, its leaves a nice White void instead of the alternate data for the div.

but that was a great thought :)

mm

mcgrailm
07-28-2008, 01:15 PM
how about this is there a way for me to test a divs display ?
that would tell me if I've processed the print css I think?

mm

toicontien
07-28-2008, 01:16 PM
This should be handled in your print CSS, as this is a style issue not a functionality issue.

Wrap your flash content in this DIV tag:
<div class="screenOnly"> <!-- Flash object code here --> </div>
Then in your print style sheet, add this declaration:
.screenOnly {
display: none;
}

Declan1991
07-28-2008, 01:20 PM
In the print style sheet have
#nonFlash {
display:block;
}

and in the non-print stylesheet#nonFlash {
display:none;
}
If they are one after another, they will occupy the same place.

Eckish
07-28-2008, 11:28 PM
This would be better suited in the CSS forum, but to help you test printing, you can get a free pdf writer. And just print to pdf. Same results as printing to paper without wasting the paper.

rnd me
07-29-2008, 12:08 AM
This would be better suited in the CSS forum, but to help you test printing, you can get a free pdf writer. And just print to pdf. Same results as printing to paper without wasting the paper.

or use print preview...