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/

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

报告相同问题?

悬赏问题

  • ¥20 ue5运行的通道视频都会有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数