$text  = "#########################\n";
$text .= "xxxxxxxxxxxxxxxxxxxxxxxxx\n";
$text .= "-------------------------\n";
$text .= "                         \n";
$text .= "-------------------------\n";
$text .= "Cultivate Orderly Queuing\n";
$text .= "Thank you for your visit\n";
$text .= date("d/m/Y h:i:s")."\n";
$printer = printer_open("EPSON TM-T82II Receipt"); //open printer
printer_set_option($printer, PRINTER_MODE, "RAW");
printer_write($printer, $text);   
printer_close($printer);

Recommended Answers

All 3 Replies

Neat example. Thanks for sharing. Just a tip. You may want to make this a Code Snippet and write a little paragraph about its use.

I'm having a bit of trouble retrieving data from the database, when using direct print or how to print directly, I include the script

$text .= "----------------------------\n";
$text .= "----------------------------\n";
$text .= "                                  \n";
$text .= "----------------------------\n";
$text .= "Cultivate Orderly Queuing\n";
$text .= "Thank you for your visit\n";
$text .= date("d/m/Y h:i:s")."\n";
$printer = printer_open("EPSON TM-T82II Receipt"); //open printer
printer_set_option($printer, PRINTER_MODE, "RAW");
printer_write($printer, $text);   
printer_close($printer); 

how about the script above, can add data from the database ?

If you did have issues you need to expand and take time to write about them. As it stands your code looked like a good start to getting receipts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.