...

View Full Version : diaplying print preview directly to the user



bhakti_thakkar
01-02-2007, 07:04 AM
hi,

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

ess
01-02-2007, 12: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...

http://domain.com/print.php?page=home

to print about page...

http://domain.com/print.php?page=about

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

<?php
$page = $_GET['page'];
// code to read page here
?>

Good luck.
Ess



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum