编程语言
首页 > 编程语言> > 使用printer_write()函数直接从PHP打印

使用printer_write()函数直接从PHP打印

作者:互联网

我发现直接从PHP打印代码:

$printer = "cups-pdf";
$ph = printer_open($printer);
if ($ph) {
    $content = "Hello World...";
    printer_set_option($ph, PRINTER_MODE, "RAW");
    printer_write($ph, $content);
    printer_close($ph);
} else {
    echo "Couldn't connect...";
}

我正在尝试在Ubuntu 14.04 LTS上使用XAMPP对其进行测试.但这给了我一个错误:

Fatal error: Call to undefined function printer_open() in /opt/lampp/htdocs/test/test.php on line 4`

我如何解决它?

解决方法:

当前,因为0001扩展名为Windows-only,所以无法安装它.the source中没有config * .m4(用于类Unix系统)文件,只有config.w32(用于Windows).

它也写在PECL包描述中:

Printer allows drawing (text, lines, ellipse, paging, etc.) and spool
controlling operation using a printer device on Windows.

标签:pecl,printing,xampp,php
来源: https://codeday.me/bug/20191118/2024916.html