Jump to content

PHP printer_write


fun7984

Recommended Posts

I have a code to connect into network printer. It is use to fread the PDF drawing or file then send it to network printer.

It is working fine in KONICA MINOLTA BH500 printer but it is not working in Canon iR3245 PCL printer. When i send the content of file into Canon printer, the printer produce some funny output (printed funny characters).

 

Please help to solve this issues, i been facing it sometime. Thanks in advance.

 

Example Code:-

function SendDocToPrinter($PrinterName,$DocName)

{

  if($ph = printer_open($PrinterName))

  {

      // Get file contents

   

  $fh = fopen($DocName, "rb");

  $content = fread($fh, filesize($DocName)); 

  fclose($fh);

         

 

  // Set print mode to RAW and send PDF to printer

 

  printer_set_option($ph, PRINTER_MODE, "RAW");

  printer_write($ph, $content);

 

  printer_close($ph);

 

  echo "<br>Document Printed<br>";

      return 1;

  }else

  {

      return 0;

  } 

}

 

Link to comment
https://forums.phpfreaks.com/topic/209314-php-printer_write/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.