这是我用于打印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;
}
}