farukweb Posted May 31, 2019 Share Posted May 31, 2019 I am making a pos(point of sale) application using object oriented php. I have found thermal receipt printers support ESC/POS . i want that when i will press button to print directly , it will do automatically. anyone can help me please. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/308773-how-to-pos-print-directly-press-button/ Share on other sites More sharing options...
ginerjm Posted May 31, 2019 Share Posted May 31, 2019 What kind of a button? A physical one that is connected to your device? Or an HTML submit button? What have you tried in code so far? Help us to help you. We will if you have a question about code! Quote Link to comment https://forums.phpfreaks.com/topic/308773-how-to-pos-print-directly-press-button/#findComment-1567174 Share on other sites More sharing options...
farukweb Posted May 31, 2019 Author Share Posted May 31, 2019 6 hours ago, ginerjm said: What kind of a button? A physical one that is connected to your device? Or an HTML submit button? What have you tried in code so far? Help us to help you. We will if you have a question about code! this is html submit button. when i will submit form, it will hit pos printer directly . Quote Link to comment https://forums.phpfreaks.com/topic/308773-how-to-pos-print-directly-press-button/#findComment-1567179 Share on other sites More sharing options...
ginerjm Posted May 31, 2019 Share Posted May 31, 2019 Are you running PHP on your local machine or on a remote server? Quote Link to comment https://forums.phpfreaks.com/topic/308773-how-to-pos-print-directly-press-button/#findComment-1567180 Share on other sites More sharing options...
farukweb Posted June 1, 2019 Author Share Posted June 1, 2019 I am running on local machine now. later i will move to live server. can you understand my issues? Quote Link to comment https://forums.phpfreaks.com/topic/308773-how-to-pos-print-directly-press-button/#findComment-1567219 Share on other sites More sharing options...
ginerjm Posted June 1, 2019 Share Posted June 1, 2019 HOw is this printer device connected so that your server will be able to talk to it? Quote Link to comment https://forums.phpfreaks.com/topic/308773-how-to-pos-print-directly-press-button/#findComment-1567222 Share on other sites More sharing options...
farukweb Posted June 2, 2019 Author Share Posted June 2, 2019 I can print easily from my pc connected with usb pos machine.I have installed driver , so that it works fine. EscPos.php try { // Enter the device file for your USB printer here // You can check the tutorial here: https://mike42.me/blog/2015-03-getting-a-usb-receipt-printer-working-on-linux $connector = new FilePrintConnector("/dev/usb/lp0"); /* Print a "Hello world" receipt" */ $printer = new Printer($connector); $printer -> text("Hello World!\n"); $printer -> cut(); /* Close printer */ $printer -> close(); } catch (Exception $e) { echo "Couldn't print to this printer: " . $e -> getMessage() . "\n"; } myform.php when i submitted a form data , it is redirecting escpos.php for printing and it prints. but i don't want like that. I want when i will submit form, it will be print directly current page without redirecting to escpos.php. Quote Link to comment https://forums.phpfreaks.com/topic/308773-how-to-pos-print-directly-press-button/#findComment-1567245 Share on other sites More sharing options...
gizmola Posted June 2, 2019 Share Posted June 2, 2019 Just move the printer code to your myform.php, assuming that is the target of the form post. Quote Link to comment https://forums.phpfreaks.com/topic/308773-how-to-pos-print-directly-press-button/#findComment-1567247 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.