使用2Printer命令行工具打印php生成的网页

时间:2017-10-30 08:18:16

标签: php command-line printing command

我正在尝试使用2Printer中的fcoder.zendesk.com(免费版)打印php生成的页面。我使用以下代码来完成任务:

<?php
exec("2Printer.exe -s 'text.php' -alert_no");
//shell_exec("2Printer.exe -s 'text.php' -alert_no");
//system("2Printer.exe -s 'text.php' -alert_no");

以上代码均无效,也不会输出任何错误。我用文本文件(.txt)尝试了它,但它仍无法正常工作。但是从正常的命令窗口(cmd),打印工作正常。有没有人有2打印机的经验,请帮忙。

2 个答案:

答案 0 :(得分:0)

1)请确保您可以从拨打2Printer的帐户访问您的源文件夹和打印机。

2)只是为了实验,请尝试调用2Printer来打印JPEG或PNG图像文件。

答案 1 :(得分:0)

这里也有同样的问题。

  1. 我注意到你错过了一些行情
  2. 在您的字符串中添加2&gt;&amp; 1以获取详细的错误消息。
  3. exec(“2Printer.exe -s'text.php''-alert_no'2&gt;&amp; 1”,$ output); 的var_dump($输出);

    我总是得到:

      

    Der Befehl“2Printer”ist entweder falsch geschrieben oder konnte   nicht gefunden werden。

    它不知道命令:'2Printer'即使使用'2Printer.exe'它也不起作用。 :(