dam89 Posted January 22, 2009 Share Posted January 22, 2009 Hello all, I have a code that allows me to print a webpage content onclick of a button and it works. I will then be prompt with the options to be saved in PDF or image writer format etc. However is here where the problem appear. I dont want the content to have the button included when i saved it to PDF or image writer. Anyone can help me with this? Currently this is what i used <input type="button" value="Print" onClick="window.print()" id=button1 name=button1> Quote Link to comment Share on other sites More sharing options...
drisate Posted January 22, 2009 Share Posted January 22, 2009 Use CSS to filtrer out what to print and what not to print Quote Link to comment Share on other sites More sharing options...
dam89 Posted January 22, 2009 Author Share Posted January 22, 2009 Sorry i am a little weak in this. I know about creating styles etc with CSS but may i know how to filter with CSS? Thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 22, 2009 Share Posted January 22, 2009 Use the media property within CSS and create a class (or classes) for elements you don't want displayed in the print. I've never really seen a good tutorial on this - there are different ways to implement. But a google search will generate some resources for more info. Here's an example. <html> <head> <style> @media print { .noPrint { display: none; } } </style> </head> <body> This will display on screen and in print<br> <span class="noPrint">This will display only on screen</span> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.