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 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多