Jump to content

Print Area Button


yandoo

Recommended Posts

Printing a page is a job for javascript.

 

Weather or not you can have javascript print a portion of the page i'm not sure. Im not aware of a way, but then im no expert. Perhaps you will need to have the button launch a page containing the information you want printed and print from there.

Link to comment
https://forums.phpfreaks.com/topic/101064-print-area-button/#findComment-516790
Share on other sites

As far as I know you'll need to create a link or button that says print.This will open up a seperate window which only displays the information you want printed. In a print friendly format ie paper size.

 

To create this page all you need to do is reuse the part of the script that displays only the information you want to print. Then its simply a matter of displaying a print submit button using javascript

 

use this code

 

 echo '<a href="javascript:window.print()">print</a>'; 

 

There might be a more elegant way to do this without opening a second browser window. But i'm unaware of this. Check out a javascript forum for more info. Although the above is the simplest way it is usually done.

Link to comment
https://forums.phpfreaks.com/topic/101064-print-area-button/#findComment-516925
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.