admin管理员组文章数量:1319471
I'm a young Web Designer and developer and im doing an internship for a corporation. I have redesigned and redeveloped most of their site, but now they have asked me to make them a shopping cart app that can print the orders directly to the orders printer when the users press the summit button on the site. I really don't have any idea on how this would be possible, i have read on Printing to a remote printer from a website about a way of sending an E-mail to the printer but i wasn't able to understand how that exactly would work and also i don't know if this is the best possible idea. If anyone can help, it would be greatly appreciated. Thanks,
Agustin Ponce.
I'm a young Web Designer and developer and im doing an internship for a corporation. I have redesigned and redeveloped most of their site, but now they have asked me to make them a shopping cart app that can print the orders directly to the orders printer when the users press the summit button on the site. I really don't have any idea on how this would be possible, i have read on Printing to a remote printer from a website about a way of sending an E-mail to the printer but i wasn't able to understand how that exactly would work and also i don't know if this is the best possible idea. If anyone can help, it would be greatly appreciated. Thanks,
Agustin Ponce.
Share Improve this question edited May 23, 2017 at 10:34 CommunityBot 11 silver badge asked May 18, 2011 at 18:48 Agustin PonceAgustin Ponce 391 silver badge2 bronze badges 4- 1 Is the hosting server connected directly to the printer, over a network, or not at all? – Jess Commented May 18, 2011 at 18:54
- 2 What is "the orders printer"? A printer on the server side? – Ted Hopp Commented May 18, 2011 at 18:54
- 1 You need a serverside solution. Send a print request then get the server to send it to the printer. – Raynos Commented May 18, 2011 at 18:57
- Maybe look at something like this: phpclasses/package/… – Jess Commented May 18, 2011 at 18:59
2 Answers
Reset to default 5Pre-requisite is that you have a way to let the webserver talk to the printer. This is the case if the printer is attached to the webserver, the printer is on the same network as the webserver or the webserver has a VPN link to the printer's network. If any of that is the case, then you can collect the data from the shopping cart on submit and print out the order form using for example IPP as AJ pointed out. There is no need to use periodic prints. Printers have their own spools and you may as well print the order at the time that it is valid.
If you do not have a way to municate with the printer, then it's a whole new ballgame. I would send an email (using PHP's mail() function or any of the mailer packages out there) to a special email address which calls a program that strips the email headers and does any needed formatting. In that case, the printer needs to be on the same network as the email server. To answer this properly, we'd need more info about the mailserver environment.
A website cannot connect to a printer, but a server can. You need a solution that incorporates the following concepts:
- A program that is capable of periodically querying your orders database for new orders to be printed. Often times cron is used on UNIX/Linux systems to schedule programs to run on a fixed interval (every 5 minutes, hourly, etc.)
- A way to send a print job to a printer from your server. Once you query the new orders and have the data formatted, you need to get it printed! Again, using PHP you can implement the necessary code to send the data to a printer via IPP. See the following library: http://www.nongnu/phpprintipp/
本文标签:
版权声明:本文标题:php - How can i make a website connect directly to a printer? so that it can print out the orders directly - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742059997a2418525.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论