PHP 无法打印到网络打印机


PHP cannot print to network printer

我有一台 ip 为 192.168.0.1 的服务器

,然后我有一台 ip 为 192.168.0.3 的计算机来访问该服务器。我有一台打印机EPSON TM-U220连接到192.168.0.3,然后我尝试使用php命令从服务器打印到打印机

copy($file, '//192.168.0.3/printername');

但它不起作用,然后我尝试了另一个功能:

exec("print /d:''''192.168.0.3''printername $file");
exec("copy $file ''''192.168.0.3''printername");

它说"unable to initialize device ''192.168.0.3'printername".我的电脑和服务器在 windows7 上运行。

我已经将打印机共享到我的服务器,我可以从服务器测试打印页面。如何使用 PHP 打印到我的网络打印机?

谢谢

经过一些研究,我找到了解决问题的方法。

运行 services.msc,然后双击 Appache Service。在"登录"选项卡上,选择"此帐户",然后填写服务器的凭据。

之后,重新启动您的appache..

这样做后我的问题解决了。.

按照 erkape#s 解决方案,我得到了 Laravel 的自动打印,水晶报告 XI 右边:

$printname="''''SERVERBEKASI''Canon iP2700 series (Copy 3)";
$driver='"winspool"';
$port='"Ne07:"';
$creport->SelectPrinter("winspool",$printname,$port);
$creport->PrintOut(fal`enter code here`se,1);

我的系统(Windows 7)上的解决方案如下所示:

  • 以管理员身份创建新帐户,设置密码
  • 运行 services.msc,双击 Apache Service。在"登录"选项卡上,选择新帐户,然后填写服务器的凭据。
  • 重新启动 Apache 。做