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
https://forums.phpfreaks.com/topic/141891-print-function/
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
https://forums.phpfreaks.com/topic/141891-print-function/#findComment-743772
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.