duangongqiong6958 2018-02-08 18:40
浏览 204
已采纳

printer_open()php支持,从web app打印可能的解决方案

Is printer_open() still supported in the latest php version? I am trying to figure out if its possible to print directly from PHP but I am not having any luck. I have found some useful questions and articles but they all use the "printer_open()" and when I try using it (even after adding the dll ext. and adding the ext to my php.ini then restarting my xampp) I get error :

Fatal error: Uncaught Error: Call to undefined function printer_open() in C:\xampp\htdocs\PHP-Printer-master\test_dll.php:6 Stack trace: #0 {main} thrown in C:\xampp\htdocs\PHP-Printer-master\test_dll.php on line 6

I also have gone into the PHP manual and can't find any refrences on this: http://us3.php.net/manual-lookup.php?pattern=printer_open&scope=quickref

I get: **

"printer_open doesn't exist. Closest matches:"

**

so my best guess is that is no longer supported? but I would like to see if there is a more concrete answer/documentation proof that is been deprecated... To make sure I am not basing my decision/research on assumptions

My ultimate goal:

I have a web application form and after all the values are input I want to be able to print a receipt with no printer dialog from mobile devices, and pc . I understand there is a browser restriction so this is technically not possible. Are there any other solutions I could use? Do I have to build an app and have the users allow it in order to accomplish something like this?

I have done some research but so far the only "viable" options are: build an app, use a windows print service.

I also found this: https://github.com/mike42/escpos-php/tree/master/example and I am still unable to get this to work (printer issues) but in the mean time I wanted to get maybe some extra feedback or opinions.

I apologize I am not an expert in this subject and I am just learning about all this as I go. Any feedback will be greatly appreciated!

Thanks!

  • 写回答

1条回答 默认 最新

  • dongwu3596 2018-02-08 19:21
    关注

    I've encountered this use case in my own business.

    You have to : - buy a Google Cloud Print enabled printer - register the printer with Google Cloud Print - create a document (receipt, invoice, etc.) in a common format, such as PDF (through some third-party PHP lib like TCPDF) - send the document to the printer through Google Cloud Print

    There's no official and easy to use PHP API available for Google Cloud Print, you will have to deal with raw json POST requests or use a third-party api lib (I wrote one, available on my github).

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

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示