I am testing a website by connecting 2 computers via router and Ethernet cables where one of the PCs has the website with WAMP and is acting as a server.
Everything is fine and working but there is one problem. I have written PHP to print the final receipt via a thermal printer which works perfectly when printing on the server computer where that thermal printer is connected via USB.
Now the problem is when the second computer working as a client accesses the website how will it print the receipt through a thermal printer connected to it via USB? The server won't find the printer connected to the client.
Of course I thought JavaScript is the best way to do it if I want to access the client's printer but that has a one big flaw.
When I load the printable content in a new window using window.open()
and then write data to it. I then call window. print();
and it does print the content but it doesn't stop. After printing the data on the receipt it keeps on pushing empty receipts out the printer and never stops.
PHP works fine, it just prints the data and then stops so that I can tear the receipt. Why won't the printer stop after printing the data when using JavaScript.
Please help. It's the only thing left..