【发布时间】:2018-11-18 04:35:39
【问题描述】:
我下载了适用于支持 TM-t20ii 的 Epson 打印机的 JavaScript SDK。 我能够使用以下 url 打印测试页:
http://192.168.2.175:9100/
打印机和电脑通过以太网连接,我可以 ping 打印机 url
输出:
OPTIONS /cgi-bin/epos/service.cgi?devid=99&timeout=10000 HTTP/1.1
Host: 192.168.2.175:9100
Connection: keep-alive Access-Control-Request-Method: POST
Origin: null
User-Agent: Mizilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Access-Control-Request-Headers: content-type, if-modified-since, soapaction
Accept: */*
Accept-Encoding: gzip, deflate,sdch
Accept=Language: en-US, en;q=0.8
但为了打印,应该使用以下请求:
http://192.168.1.175/cgi-bin/epos/service.cgi?devid=999&timeout=10000
(如果我对 9100 端口使用相同的请求,我会得到 http://192.168.2.175:9100/ 的相同结果打印输出
405 (Method Not Allowed)
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.2.172' is therefore not allowed access. The response had HTTP status code 405
我读到我必须从打印机上的 EpsonNet 配置中启用 ePOS-Print 设置,但配置没有这样的选项。
我无法确定如何检查此设置是否启用或应使用哪个端口或是否需要任何其他配置,我检查了打印机手册和打印机 sdk,但没有运气。
【问题讨论】:
-
嗨。之后你有没有运气。我遇到了一个类似的问题,即 EpsonNetConfig(我正在使用 TM-U220 的 Web)没有这个选项。
-
您好,我们使用了这个插件:github.com/aelx311/cordova-plugin-epos2,因为应用程序是使用 phonegap 和 cordova.js 构建的混合移动应用程序
-
谢谢,但我们发现缺乏明确的文档或官方支持。此外,我们专注于基于桌面的 Web 应用程序,因此我们找到了更适合我们需求的库 [Node ESCPOS] (github.com/song940/node-escpos) :)
-
@gabyawad,您是否能够从 HTTPS Web 应用程序进行打印?您是否遇到过跨内容问题?如果是,那么您是如何解决的?
-
@NirajPatel 我们需要移动应用程序的功能,我们最终使用了这个库:github.com/cspsolutions/epson_printer,但它也不支持所有内容。
标签: javascript thermal-printer epson printing-web-page