Jump to content

PRINT FUNCTION!


dam89

Recommended Posts

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>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.