문제

I own Sewoo Thermal Printer that is connected to a local PHP point of sale. Now as a simple print test using php, I wrote the following code :

<?php
$handle = printer_open("THERMAL LK-TXXX");
$handle = printer_open();
?>

And I got this Error :

Fatal error: Call to undefined function printer_open() in C:\wamp\www\frame\reciept.php on line 2

I'm using Wampp as my web server, Windows 7 and I've installed the correct drivers for my printer. How can i fix this problem, Or is there an alternative "Print" methode using PHP to automatically print without showing Print preview?

Thank You

도움이 되었습니까?

해결책

A POS printer is (mostly) not a printer in the sense of using the Windows printing functions to create output, that is quite independent of the device, but simply a sink for serial data in the printer's control language (we built a ticketing system driving very similar printers).

One approach is to user the Win32API extension for PHP and the OpenDriver API, but this turns out to be quite a mess. Best way is to simply fopen() the printer port and write your PCL data via fwrite()

다른 팁

You are probably getting this error because the printer extension is not installed. From the PHP manual:

Installation

This » PECL extension is not bundled with PHP.

Windows users must enable php_printer.dll inside of php.ini in order to use these functions. A DLL for this PECL extension is currently unavailable. See also the building on Windows section.

Installation instructions can be found here: http://php.net/manual/en/install.windows.building.php

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top