print to a network printer using PHP

試著忘記壹切 提交于 2019-12-01 05:45:01

问题


is it possible to print directly to a network printer with PHP using LPR or something similar?

any pointers?

thanks.


回答1:


Sure is. If you are on Linux do use LPR.

exec("lpr -P 'printer' -r 'filename.txt'");

More on LPR commands. Take a look into LPR docs. You can easily show the print-queue and more from PHP.


If you are on Windows use print

exec("print /d:LPT2: C:\filename.txt");

More on print syntax
Or take a look into this guide that has a deeper explanation of command-line printing.




回答2:


//[reader path] /t [pdf path][printer]-Print the document with designated printer

exec(" \"$prAddr1\" /t $val  \"$prAddr2\" ");


来源:https://stackoverflow.com/questions/3722805/print-to-a-network-printer-using-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!