Open TomaIvanovTomov opened 5 years ago
Are you running this code via apache or via cli?
try to run the code from command prompt logged as an administrator - if the problem stems from insufficient privileges, you will succeed and need to elevate xampp rights. On the other hand if test fails again , it might be a printer issue.
BTW Question from the screen above : you have a printer on LPT1 as well. Do you print on LPT1 without any problem using the same code?
I've had the most luck with network printing on Windows. You can share the printer to the LAN and then connecting to it over localhost (see this blog post, command-line examples here).
You can then restrict access to the printer based on user accounts (connect with smb://user:password@host/printer
), or by using the machine's firewall to limit the print sharing service to localhost.
In any case, best find something that works the command-line before you start programming in PHP, since we just wrap calls to write to files and net use
in the background.
As some other options:
Also, be wary of the suggestion to elevate XAMPP.
That should not be necessary, and runs against security best practices.
And how can I send instruction? I mean to row out a little bit of empty paper, I have to send instruction "2C" wich is hexdecimal instruction. Is it possible here and if so - with wich method, because I couldn't find it? Thank you mike and velislav!
@TomaIvanovTomov You would use $printer -> feed()
for that.
$printer -> getPrintConnector -> write(chr(1) + chr(36) + chr(60) + chr(44) + chr(5) + chr(48) + chr(48) + chr(57) + chr(49) + chr(3));
if the printer is a fiscal device.
@TomaIvanovTomov ? the model of the pos printer is ......
It is ELTRADE A3. The printer is not at my place at this moment .. I am really curiouse about making it works and will try your example as soon as I get it again! Will give feedback for sure.
Well hi there! I am pretty new to this POS things and want to ask you for a little advice. My case is like so - I am trying to connec to Eltrade POS device ( wich is not listed as working one but I hope it will be soon :) ) via USB. I am not familiar with the hardware but I think it is connected on COM4 port so I am searching it there like so:
I get this information from Windows device manager from section Porst ( COM and LPT ) and this is how it looks like: The error I get is :
Where and how I should give permissions ? Is it about device permissions or some port permission ( if it has things like that ) ? I am working on Windows 10. Using XAMPP for testing purpose. Thank you very much!