View Full Version : diaplying print preview directly to the user

01-02-2007, 08:04 AM

Best Wishes 4 the new year!!!

i have a print button on the page.Onclick i open the same page in a new window where in the user can print the page content. But now i want that the user should be directly show the print preview so that the user knows how and what will be printed on the page[ specially the remarks column which are toooo large].i dont how to do it ???
whether i have to use javascript or php :confused:
thanks in advance

01-02-2007, 01:23 PM
You can use either...but JavaScript can be disabled and hence...I would suggest that you use PHP.

Though, I think a combination of PHP and JavaScript is best. That is, if the user has not disabled JavaScript...then JavaScript will be used to provide the print preview and that would save the user a trip to the server in order to get a print preview.

If you are to use JavaScript...than you can control which elements of the website are to be printed by using CSS and JavaScript. Just do a google search on that...and I am sure you find loads of examples.

As for using PHP...you will need a page on the server to take care of that. for example, to print the home page...


to print about page...


in your print.php page...you should get the page to be printed like so

$page = $_GET['page'];
// code to read page here

Good luck.