如何打印 ipp 打印机设置
所以我试图通过 PHP 代码在我的本地主机中打印 PHP 生成的文件。有人告诉我检查 http://www.nongnu.org/phpprintipp/ 我发现了这段代码他们在文档中声称这是最简单的设置。
<?php
require_once(PrintIPP.php);
$ipp = new PrintIPP();
$ipp->setHost("localhost");
$ipp->setPrinterURI("/printers/epson");
$ipp->setData("./testfiles/test-utf8.txt"); // Path to file.
$ipp->printJob();
?>
作为初学者,我通过查看上面的代码得出了这个基本逻辑。首先,我通过 PHP 生成 .txt 文件。
其次,我创建该类的新实例,因此对象执行以下操作:查找主机(在我的例子中是 localhost,因此无需编辑),查找打印机,查找要打印的文本文件(已生成),并执行打印作业。是的,我知道这看起来很简单,但我似乎找不到打印机 URI。
如何做到这一点,因为我对此完全不熟悉...我想打印机在本地主机中必须有某种IP(不确定)。如果是这样我怎样才能找到它?
So I'm trying to print a file generated by PHP in my localhost through PHP code. I was told to check http://www.nongnu.org/phpprintipp/ and I found this code that they state as the easiest setup in their documentation.
<?php
require_once(PrintIPP.php);
$ipp = new PrintIPP();
$ipp->setHost("localhost");
$ipp->setPrinterURI("/printers/epson");
$ipp->setData("./testfiles/test-utf8.txt"); // Path to file.
$ipp->printJob();
?>
As a beginner, I made this basic logic by looking at the code above. First of all, I generate the .txt file through PHP.
Secondly, I create this new instance of the class and so on the objects do the following: find the host (which is localhost in my case, so no need to edit), find the printer, find the text file to be printed (already generated), and do the print job. Yes I know it seems pretty straightforward, but it seems I can't find the printer URI.
How to do that as I am totally unfamiliar to this... I guess the printer must have some kind of IP in the localhost (not sure). If so How can I find it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗨!
我是 PHP::PRINT::IPP 作者
您最好发送到邮件列表(这是一个真正的异步响应)
:)
[电子邮件受保护]
首先,我强烈建议检查 cvs 存储库:
cvs -z3 -d:pserver:[email protected]:/sources/phpprintipp co phpprintipp
(需要cvs程序)
如果您直接打印到网络打印机(不带 CUPS),或使用 CUPS 之外的其他 IPP 服务器:
检查您的打印机/server 手册,用于处理您希望使用的文档格式(很可能您只会得到文本/纯文本和 PostScript,即使在高质量打印机上,作为最后一个选项,mime 类型“application/octet-stream “ 指定您的打印机语言(PCL,...)-- 这不是有关 rfc2911 的标准-或文档格式自动-检测 这是标准)。您可以在连接到服务器时使用 PHP::PRINT::IPP 请求支持文档格式或整个打印机的特性(请参阅主站点上的文档(URI 位于 检查您的打印机/服务器手册,
将您的网络浏览器指向 您的打印机/或打印服务器的 IP/fqdn 端口 631
例如:
<前><代码>http:// xxx 。 xxx 。 xxx 。 xxx:631
(IPv6 地址在 php::print::ipp 中也可以,但我从未尝试使用网络浏览器(最有可能使用括号 [::1]:631))
(您在网络中浏览器服务器-IP:631) 检查“打印机”路径例如:“/epson/”
=>路径是在 BasicIpp 中基于“CUPS”完成的:
=>所以
=>最有可能的是“/blah/”“/blah/”“/blah/”“/blah/”四个路径:)
=> 也可以用“/”表示 4
(“jobs”指定作业(打印)控制/检查路径,而“root”,好吧,如果您不知道,那么您很可能使用 MS-Windows,其中 MS-Windows IPP 嵌入式服务器无法与该库一起使用 - 可能除了文本/纯文本)
注意:如果可以安装“PostScript 驱动程序”,那就太酷了" 在 MS-Windows 服务器上然后检查使用 PHP::PRINT::IPP 或其他 IPP 客户端至少处理 PostScript 格式
(您使用的是 Web 浏览器服务器 IP:631)检查您的“printer-uri”,如打印中所做的那样服务器设置。
=>然后:
警告
=> 无关
这与Nor
这最后 3 个函数提供了与打印服务器的连接
主站点(指向文档、安装等的链接...他们害怕这里的垃圾邮件:)
< a href="https://savannah.nongnu.org/projects/phpprintipp" rel="nofollow">项目/简历/新闻
问候,
TSFH
[电子邮件受保护]
Hi!
I'm the PHP::PRINT::IPP author
You'd better to sent to the mailing list (this is a really asynchronous response)
:)
[email protected]
In first I strongly recommends to check the cvs repository:
cvs -z3 -d:pserver:[email protected]:/sources/phpprintipp co phpprintipp
(you needs cvs program)
If you print directly to a network printer (without CUPS), or use another IPP server than CUPS:
check your printer/server manual for handling of documents formats you whish to use (most probably you'll get only text/plain and PostScript, and as an option for last even on high quality printers, the mime type "application/octet-stream" designates either your printer's language (PCL, ...) -- which is not the standard regarding rfc2911 -- or document format auto-detection which is the standard). You can request for document-format-supported or the whole printer's characteristics with PHP::PRINT::IPP while connected to server (see documentation on main site (URI given at that post end)
points your web browser to IP/fqdn of your printer/or print server port 631
eg:
(IPv6 addresses are OK too in php::print::ipp, but I never try with a web browser (most probably use brackets [::1]:631))
(you are in web browser server-IP:631) check for the "printers" paths eg: "/epson/"
=> paths are done on "CUPS" basis in BasicIpp:
=> so
=> most probably "/blah/" "/blah/" "/blah/" "/blah/" for the four paths :)
=> can also be "/" for the 4
("jobs" designates the jobs (printings) control/check path, and "root", well, if you don't know that then you most probably uses MS-Windows which MS-Windows IPP embedded server will not be usable with that library -- excepting maybe for text/plain)
note: It would be cool if s.o. could install the "PostScript driver" on a MS-Windows server then checks for handling of at least PostScript format with PHP::PRINT::IPP or other IPP clients
(you are in web browser server-IP:631) check for your "printer-uri" as done in the print server setup.
=> then :
WARNING
=> this has nothing to do with
nor
These 3 last functions gives connectivity to print server
main site (links to doc, install, whatever... They are afraid of spam here :)
project / cvs / news
Regards,
TSFH
[email protected]