0

I have developed web application for restaurant and i am trying to connect printer through php code. JavaScript print function is working fine but it opens browser print dialogue to give command to printer but i want to connect it with directly through php. I tried a lot by surfing on internet but i am not being able to connect printer through php code. I have found code on internet and tried with it but it shows error on line number 3. I have attached the code below. Please tell me what is the error on line number 3? Thank you so much in advance. :)

<?php 
 // start printer 
$handle = printer_open("Samsung SCX-4x21Series"); 
printer_start_doc($handle, "My Document");
 printer_start_page($handle); // create content here // print
 printer_end_page($handle); printer_end_doc($handle);
 printer_close($handle); ?>
Bibek
  • 61
  • 1
  • 7
  • 1
    this might be helpful http://stackoverflow.com/questions/4956143/print-directly-to-network-printer-using-php – Riaz Laskar Aug 08 '15 at 06:56
  • Just a guess here but you are probably going to have to put in a path too your printer (see the comments at the bottom of the printer_open doc page for some examples) – Orangepill Aug 08 '15 at 07:07
  • @RiazLaskar I tried it but it shows error like " Fatal error: Call to undefined function printer_open() in C:\xampp\htdocs\printme\index.php on line 2 " how to make printer_open() function defined? – Bibek Aug 08 '15 at 07:46

0 Answers0