ESC-POS printing issue.

548 views
Skip to first unread message

ako...@gmail.com

unread,
Dec 6, 2017, 7:55:09 AM12/6/17
to PHP Desktop
First of all I could never thank you and your collaborators enough for building such a wonderful tool.

I have been using 'PHP Desktop'(>=5.3 on Windows 7 x64) to create an app that caters to a local pharmacist for his billing and inventory.

He uses a EPSON LX300+II Dot matrix printer(USB type) with support for ESC/POS system to print his sale bills. I use Mike42's PHP ESC-POS module that easily enables me to send POS print commands to the printer and it works just fine.

However, it seems that all of the tedious work that I have put into building this app will never see the light of day. The print commands work fine only for about an hour. What I mean is, almost an hour after I take the last print, the printer refuses to respond and any further print request.

Here is a what I spotted in the debug log:

`

17:03:18.450 INFO: GET 200 /home/api/printSale/?invoice=A201
[1206/170318:INFO:CONSOLE(160)]

"ERROR", source : http://127.0.0.1/vendor.f98484e540fba09768ba.bundle.js (160)

[ 1206/170318 : WARNING : dns_config_service_win.cc(673)] Failed to read DnsConfig.

`

Czarek Tomczak

unread,
Dec 6, 2017, 8:57:36 AM12/6/17
to PHP Desktop
Is the javascript error related to your issue? Check line 160 in your js file.

Looks like your php script is buggy or there is a problem with the printer.

ako...@gmail.com

unread,
Dec 7, 2017, 2:23:33 AM12/7/17
to PHP Desktop
Thank you for responding.

This is very unlikely to be a JS error. My client side interface is based on Angular JS 2, and all it does is send an API request to a PHP page at:

"/home/api/printSale/?invoice=A201"

My php script finds and generates a raw text format of the invoice 'A201' and then sends it to an external ESC-POS PHP module by Mike42(Git). The printing is entirely handled by this module and it works too....but only for an hour or so as I mentioned earlier.

An hour later this is the exception thrown by PHP:

"Warning : copy(\PC-Name\Printer-Name): failed to open stream: No such file or directory.."

It keeps on popping up until I remove and re-install the printer again. It works fine for about an hour and the same thing repeats.

I have no earthly clue of what is going on as I have tried most of the fixes i found online from disabling antivirus/firewall, granting full access and permissions, heck the printer even seems to be printing via the command prompt.

I wonder if "Failed to read DnsConfig" has something to do with it.

Thank you for your time.

ako...@gmail.com

unread,
Dec 7, 2017, 2:33:05 AM12/7/17
to PHP Desktop
My PHP print code:

function printSale($data, $printer_name)
{
try
{

$connector = null;
$host_name = gethostname();

$connector = new WindowsPrintConnector('smb://'.$host_name.'/'.$printer_name);

$printer = new Printer($connector);

$printer -> feedDownEpsonLX300(100);
$printer -> tinyFontEpsonLX300();

$printer -> text($data); //Printing begins here

$printer -> feedUpEpsonLX300(100);
$printer -> cut();
$printer -> close();
}
}

Czarek Tomczak

unread,
Dec 7, 2017, 2:54:00 AM12/7/17
to PHP Desktop
That warning is the cause of your issues, it cannot connect to printer. PHP runs separately and has nothing to do with the browser. You should contact the author of that module to resolve the issue.


"Warning : copy(\PC-Name\Printer-Name): failed to open stream: No such file or directory.."

ako...@gmail.com

unread,
Dec 7, 2017, 6:23:36 AM12/7/17
to PHP Desktop
Yes I already have but he hasn't responded yet. I hope he sees it some day. I will keep you posted.
Reply all
Reply to author
Forward
0 new messages