how to print a receipt to a particular printer?

Print to external receipt printer using PHP

  • I'm trying to find a solution for sending live orders to a receipt printer. Are there any API's that can do this? Or are there any types of software a location can install that PHP can communicate through in any way? Basically in pseudo-code: if ($order == 'success') { $printer = ip.to.remove.printer; $receipt_text = 'You just received an order!'; $ch = curl_init('http://addresstosomekindofapi.com/print_receipt/'); curl_setopt($ch, SOME_OPTION, 0).............; curl_exec($ch); curl_close($ch); } I'm just exploring options in getting this done. It would be awesome to be able to do this rather than send faxes which often have tied up lines, etc, etc. It can even be some sort of software for printing live emails to the receipt printer. Any solid suggestions would be appreciated! Regards!

  • Answer:

    To me, a solid solution is to build a desktop application that is connected to your web application and has the ability to send jobs to the printer. I don't think a web application can have much of control as to handle user's print jobs.

Jordan at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

if you can access the printer with ipp, then http://www.nongnu.org/phpprintipp/ should be a very nice solution.

roman

There is already a PHP extension for sending jobs to printers. See http://php.net/manual/en/book.printer.php

John Cartwright

There are printers (like your basic office hp laserjets I guess) that can Be reached trough ftp Have 'virtual printer' modes for paper selection. I'd look into that if I were you. (this was assuming there is some sort of network separation between the printer and the php file.)

Nanne

You may want to check out the http://my.php.net/manual/en/ref.printer.php.

Kibbee

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.