php LPR打印机类
发布时间:2020-12-13 15:55:51 所属栏目:PHP教程 来源:网络整理
导读:如何使用LPR Printer类使用USB打印机EPSON LQ-1150打印txt文件? ?php include("PrintSend.php");include("PrintSendLPR.php");$lpr = new PrintSendLPR(); $lpr-set-host("192.168.1.152"); //Put your printer IP here $lpr-setData("C:wampp2htdocs
如何使用LPR Printer类使用USB打印机EPSON LQ-1150打印txt文件?
<?php include("PrintSend.php"); include("PrintSendLPR.php"); $lpr = new PrintSendLPR(); $lpr->set-host("192.168.1.152"); //Put your printer IP here $lpr->setData("C:wampp2htdocsprinttest.txt"); //Path to file,OR string to print. $lpr->printJob("someQueue"); //If your printer has a built-in printserver,it might just accept anything as a queue name. ?> 在那个设置主机中我们要使用共享打印机名称还是主机? 解决方法
这是我用于打印IP打印机的命令:
您需要在服务器上安装Windows和Linux的lpr服务. if ($this->agent->platform() == 'Linux') { $command = 'lpr -S ' . $printer->printer_ip . ' -P ' . $printer->printer_name . ' -o -x ' . $file; //$command = 'lp -d ' . $printer->printer_name . ' ' . $file; if (exec($command)) { return TRUE; } else { return FALSE; } } if ($this->agent->platform() == 'Windows XP') { $command = 'lpr -S ' . $printer->printer_ip . ' -P ' . $printer->printer_name . ' -o -x ' . $file; if (exec($command)) { return TRUE; } else { return FALSE; } } if ($this->agent->platform() == 'Unknown Windows OS') { $command = 'lpr -S ' . $printer->printer_ip . ' -P ' . $printer->printer_name . ' -o -x -d ' . $file; if (exec($command)) { return TRUE; } else { return FALSE; } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容