+ Start a Discussion
SethSeth 

PrintAnything, Style Sheets, Print Button

I have been able to successfully get PrintAnything to format data as necessary, but am having some troubles with one of the finishing touches:

In order to allow people to easily print the output, I've added a javascript "Print" button.  The problem is, however, that since PrintAnything does not accept stylesheet calls (I need to call a "media" stylesheet in this case), I am unable to use javascript code to "hide" the print button when the document is actually printed.

This means that every printout has a big "Print" button on it, which is obviously less than desirable.

Has anyone figured a way around this?

Thanks,
Seth
sdudasduda
Seth,

Add this to the Print Anything Driver s-control:
( It goes near the bottom of the page inside the css tag )

Code:
@media print {
    .hidden { display: none; }
}

 


And then in your template, just add the "hidden" class to anything you want to hide when you print the page.

For example:

Code:
<div class="hidden">
<input type="button" value="Print Me!" />
</div>

 
-- Seth

Message Edited by sduda on 04-03-2007 06:35 PM

JonSimmonsJonSimmons
Since the new version of the S-Control is managed I can't do this anymore, is there some new way that this can be accomplished?
 
Thanks
Jon
 
JonSimmonsJonSimmons

Here is my current solution.

<div id="printdiv"><form id="printform"><input id="printbutton" type="button" value="Print" onclick="printdiv.style.display='none';window.print();printdiv.style.display='inline'" /></form></div>