doudeng3008 2019-07-04 20:15
浏览 132
已采纳

有没有办法在PHP中存储通过Windows PC发送的打印作业?

I am working on a project for school. I am wondering if there is a way in PHP to listen for print jobs and store them once received? I currently have a webserver that is accepting webhooks from other applications, parsing out the JSON and storing in a MsSQL. Is this the wrong path to take? thanks

  • 写回答

1条回答 默认 最新

  • doufangyan6862 2019-07-05 11:08
    关注

    Ok – I don’t know if this is a solution but here is my attempt at trying to help :)

    Disclaimer: I am not affiliated to any of the links posted here and (or) make no recommendations.

    General assumptions:

    1. PHP is the server side language used in all instances (the theory should work with others as well – using PHP as the question was tagged as such)
    2. Sender and receiver servers are different (it is more easier if both are on the same box – but not a show stopper)
    3. Access to both sender and receiver webservers
    4. Windows set up (WAMP or alternative)
    5. You are securing your set up / directory accesses as you go along

    Option 1 (Custom sender / receiver)

    On the box that is sending the print request:

    On the box that is receiving the file:

    • Create a PHP script to read files on remote

    • Show files to print in a list which can be downloaded to local terminal / device and printed

    Option 2 (Leverage an existing print server)

    In this option you would only need to amend the sender webserver config: [inspired by: https://www.hashbangcode.com/article/printing-directly-php]

    • Download php_printer.dll for your version (https://windows.php.net/downloads/pecl/snaps/printer/0.1.0-dev/)
    • Enable in php.ini via: printer.default_printer=PHP_INI_ALL extension=php_printer.dll
    • Set the printer as your print server address and send your output to print directly from the Webserver as follows from your application:

      ` $data= "Hello"; printer_set_option($ph, PRINTER_MODE, "RAW"); printer_write($ph, $data); printer_close($ph); } else "Couldn't connect..."; ?>'

    Option 3 (Use a plugin): https://www.neodynamic.com/products/printing/raw-data/php/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 fluent里模拟降膜反应的UDF编写
  • ¥15 MYSQL 多表拼接link
  • ¥15 关于某款2.13寸墨水屏的问题
  • ¥15 obsidian的中文层级自动编号
  • ¥15 同一个网口一个电脑连接有网,另一个电脑连接没网
  • ¥15 神经网络模型一直不能上GPU
  • ¥15 pyqt怎么把滑块和输入框相互绑定,求解决!
  • ¥20 wpf datagrid单元闪烁效果失灵
  • ¥15 券商软件上市公司信息获取问题
  • ¥100 ensp启动设备蓝屏,代码clock_watchdog_timeout