Jordan
Jordan

Reputation: 416

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;

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

How could one achieve this?

Upvotes: 0

Views: 12210

Answers (3)

Ezekiel
Ezekiel

Reputation: 1

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

Upvotes: 0

Saad
Saad

Reputation: 13659

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.

Upvotes: 1

Nanne
Nanne

Reputation: 64409

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

Upvotes: 0

Related Questions