fohanlon Posted November 8, 2007 Share Posted November 8, 2007 Hi Guys Could anyone tell me how to go about the following - do I use css print style sheet or php. I am using php and mysql to pull out and display records onto a webpage. I have an option view all records that lists all records in the table. I also have an option print all records. However, my issue is when I go to print on some pages the information is split for example half the image on the bottom of the page and the other half on the top of the new page. is there any techniques to force say 5 rows per page and then force a new page on the printer and print 5 more etc. I was going down the create pdf route but the file is large and user is left waiting for file to be generated. Many thanks, Fergal. Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 8, 2007 Share Posted November 8, 2007 You can refer PHP Printer_functions, I think it can be done like this <?php $handle = printer_open(); // you can fetch data and store in a variable then print printer_write($handle, "Text to print"); // keeping it here // and after 5 records prints then you can close printer_close($handle); ?> Windows users must enable php_printer.dll inside of php.ini in order to use these functions. Quote Link to comment Share on other sites More sharing options...
fohanlon Posted November 8, 2007 Author Share Posted November 8, 2007 Many thanks will try this and let you know how I get on. Fergal. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 8, 2007 Share Posted November 8, 2007 well printing a page is always an issue in web design as the transition from server -> browser -> Printer is never the same. The best way is the pdf as you described as it removes all browser headings and you get a universal print, the print software in php won't get you anywhere as this is for internal printing on a server like a log file being printed every X days via a cron, it can't force print on a client. I'd say pdf unless you want to fight the css to make it perfect, as for the five rows per page that is again a styling thing use a modular <?php $i = 0 while($row = mysqlfetch){ if($i%5 = 0){//New page} } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.