php script to print the webpage or file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpdev12
Forum Newbie
Posts: 1
Joined: Fri Aug 28, 2009 5:14 am

php script to print the webpage or file

Post 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?
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: php script to print the webpage or file

Post 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();
Post Reply