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

有没有办法在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 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记