开发者

Print to external receipt printer using PHP

I'm trying to find a solution for sending live orders to a receipt printer.

Basically in pseudo-code:

if ($order == 'success')
{
    $printer = ip.to.remove.printer;

    $re开发者_Python百科ceipt_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.

How could one achieve this?


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.


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.)


I think that the best solution to your problem is printing the document to pdf using a php class for printing to pdf. There are quite a few of such classes. A good one is ezpdf class which can be downloaded from http://www.ros.co.nz/pdf or http://www.sourceforge.net/projects/pdf-php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜