PDA

View Full Version : Printing from browsers



bubonic
28 Apr 2010, 07:29 AM
Hi,

There are certain pages on my site that contain graphs and other tabular data that I would like to provide a "Print" button for; that, when clicked, launched the user's default print dialog and allows the user to print that page...

However, I want to be able to only specify the graph or tables as part of the print. In fact, through this Print button, I don't want the user to be able (!) to print any other components of the page, including the traditional print headers and footers that most browsers insert automatically, such as showing the URL of the page being printed, page numbers, etc.

Is this even possible? How can I basically declare certain sections/divs/etc. of my page printable and only allow those items to be printed through this custom Print button? No headers or footers. No requirement that the user first highlight the graph or table and then print "selected highlighted" in the print dialog...

?

Thanks for any feedback!

bubonic

<CrGeary.com/>
28 Apr 2010, 08:18 AM
Im not sure if you can do that, you would have to try it out. You could try the following.


<a href="javascript:void();" onclick="document.element_name.print();">Print</a>

i dunno if that will print just that element, or the whole page?, you could do this:


<link href="print.css" rel="stylesheet" media="print" />

Then in the print stylesheet you can tell your site to only show the content (so you can go: #sidebar { display:none;}

Thats the only thing i cant think of.