0

I have POS software in Which Receipt is print with 3 to 4 step. this is long method. i want to Receipt print without showing window print dialog box. direct print to the printer i am using php CodeIgniter Web Framework. after showing receipt on print button the function is following

function PrintTicket() {
   $('.modal-body').removeAttr('id');
   window.print();
   $('.modal-body').attr('id', 'modal-body');
}
<button type="button" class="btn btn-add hiddenpr" onclick="PrintTicket()"><?=label("print");?></button>
Pradeep
  • 9,667
  • 13
  • 27
  • 34

2 Answers2

0

We can do in the following way:

//For hide dialog box
function PrintTicket() {
   $('.modal-body').modal('hide');
   window.print();   
}

//For show dialog box
function PrintTicket() {
   window.print();   
   $('.modal-body').modal('show');
}
Red
  • 6,599
  • 9
  • 43
  • 85
Sanjay Kumar
  • 424
  • 5
  • 15
0

you can use php for print directly to printer.

you can use mike42 escpos github plugin.

after download you need to make a connector for your printer. use this

after you can print. my sample for a shared printer and for a php file that is running by schedule task is:

require 'vendor/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\CapabilityProfile;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;


$connector = new WindowsPrintConnector("smb://computername/printername");
$printer = new Printer($connector);

$printer -> text("hello world");
$printer -> text("\n");
$printer -> text("\n");
$printer -> text("hello again");
$printer -> cut();
$printer -> close();
rezaSefiddashti
  • 134
  • 1
  • 9