Print preview in php or javascript

Hello all,

For printing I know that java script window.print() is used and to print
particular area we use css media print.

But I want to know is it possible to have a print preview before printing using php.
Any help will be appriciated.


I think its possible, you have to make a script for that to pass values from
the prev script.

You could offer a link to a “printerfriendly” version of the page

<a href="page.php?print=1">printerfriendly</a>

Then, in the <head> section of page.php, check if print == 1. If it is link to the print stylesheet, otherwise link to the regular screen stylesheet:

<link rel="stylesheet" href="css/<?php echo $_GET['print'] == 1 ? 'print' : 'screen'; ?>.css" type="text/css" />