function listprinter() { $PrintDests = printer_list(PRINTER_ENUM_LOCAL); echo 'This is a list of printers that connect to the server.<br>'; echo '<UL>'; foreach ($PrintDests as $PrintDest) { echo '<LI>' . $PrintDest["NAME"] . '</LI>'; } echo '</UL>'; echo 'Use one of this list to set PRINTERNAME in config file.<br>'; echo 'Please install php_printer.dll to extension_dir and enable extension=php_printer.dll in php.ini before using print.'; }
/** * Show Printers Found Connected to this PC * * @return array */ public function enumerate() { /* If there are no printers, find them */ if (count($this->printers) == 0) { $printer_list = printer_list(PRINTER_ENUM_LOCAL); foreach ($printer_list as $printer) { if (in_array($printer['NAME'], $this->ignore) == FALSE) { $this->printers[] = $printer; } } } return $this->printers; }
<?php if (function_exists('printer_list')) { $printerList = printer_list(PRINTER_ENUM_LOCAL, "", 5); foreach ($printerList as $printer) { echo $printer['PRINTERNAME'] . '<br>'; } //var_dump($printerList[1]['PRINTERNAME']); } else { echo "Las funciones de IMAP NO están disponibles.<br />\n"; } //$printerList = printer_list(PRINTER_ENUM_LOCAL); //var_dump($printerList[0]['NAME']);
<?php /* detectar impresora compartida localmente */ //var_dump(printer_list(PRINTER_ENUM_LOCAL | PRINTER_ENUM_SHARED)); var_dump(printer_list(PRINTER_ENUM_LOCAL)); echo "<hr>"; //exit; //if($handle = printer_open("HP Deskjet D1600 series (Copiar 1)")){ if ($handle = printer_open("EPSON TM-T88V ReceiptE4")) { echo "Imprimiendo..."; /*printer_write($handle, "Texto a imprimir"); printer_close($handle);*/ } else { echo "error al conectar con la impresora"; }