Page 1 of 1

php script to print the webpage or file

Posted: Fri Aug 28, 2009 5:20 am
by phpdev12
Hi,
I am working on shopping cart...
when user places the order that particular order should be printed using php script to client printer.
How can we do that?What I am doing is, getting the data from mysql and displaying this on webpage and also want to print it to client printer (not the user's printer).For the same I have client printer details.How to proceed further can anyone help?

Re: php script to print the webpage or file

Posted: Fri Aug 28, 2009 2:03 pm
by Darhazer
phpdev12 wrote:Hi,
I am working on shopping cart...
when user places the order that particular order should be printed using php script to client printer.
How can we do that?What I am doing is, getting the data from mysql and displaying this on webpage and also want to print it to client printer (not the user's printer).For the same I have client printer details.How to proceed further can anyone help?
You cannot print the order on the client printer, using php, as php works on your server, not on the client's computer... and what if the client have no print.

You can however using javascript to open the print dialog in the browser, so the user should just click 'print' (or set any settings and then print if he'd like). This is achieved via:

Code: Select all

window.print();