gpt4 book ai didi

php LPR 打印机类

转载 作者:可可西里 更新时间:2023-10-31 23:39:41 24 4
gpt4 key购买 nike

如何使用 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:\\wampp2\\htdocs\\print\\test.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;
}
}

关于php LPR 打印机类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30184631/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com