PHP 热敏打印客户端

发布于 2024-11-02 12:56:31 字数 208 浏览 5 评论 0原文

我有一台爱普生热敏打印机,型号为 TM-T20,我正在为客户安装它。

我们的网络服务器是 Linux 服务器,客户端计算机是 Windows 计算机。

是否可以使用php直接控制连接到客户端计算机的热敏打印机?

我看过 javascripts window.print(),但这不是我想要的,如果可能的话我想绕过打印对话框。

谢谢, 托尼

I've got a Epson Thermal printer, model TM-T20 which I'm setting up for clients.

Our webserver is a linux server, and the client machines will be Windows machines.

Is it possible with php, to directly control the thermal printer attached to the clients computer?

I have looked at javascripts window.print(), but that is not what I want, if possible I want to bypass the print dialog.

Thanks,
Tony

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情感失落者 2024-11-09 12:56:31

不。PHP 与客户端的打印机完全没有任何关系。如果打印机连接到运行 PHP 脚本的机器(即服务器),您可能可以做一些事情。事实上,PHP 只向客户端发送文本。从那里,客户端的浏览器和打印机软件必须处理它。

或者,如果 Windows 机器运行一个打印服务器,公开 PHP 可以通过网络与之通信的打印机,那么您可以直接与打印机通信。但这不再是正常的 PHP 服务器/客户端关系。

No. PHP has absolutely nothing to do at all with the client's printer. If the printer was attached to the machine the PHP script is running on (i.e. the server), there may be something you could do. As it is, PHP only sends text to the client. From there, the client's browser and printer software has to handle it.

Alternatively, if the Windows box ran a print server exposing the printer that PHP could talk to over the network, you could talk to the printer directly. But that wouldn't be a normal PHP server/client relationship anymore.

热情消退 2024-11-09 12:56:31

从 php 打印并不是那么容易,我见过的大多数网络应用程序都会生成 pdf,然后客户端打印它。

看看 http://www.vendhq.com/ 他们为商店做了一个销售点应用程序,并有一些您需要下载和安装的东西,以便通过收据打印机打印收据摘要。它可能会给你一些灵感

printing from php isn't that easy, most web apps i have seen generate a pdf and and the clients print that.

have a look at http://www.vendhq.com/ they do a point of sale app for shops, and have something you need to download and install to print till dockets via a receipt printer. it might give you some inspiration

情话墙 2024-11-09 12:56:31

我以前就这么做过。这是相当棘手的,使用工作场所 LAN 上的 ubuntu 服务器和运输区域另一台 ubuntu 计算机上的热敏打印机。那台计算机正在运行一个监听端口的 php 服务,并且是无头的,隐藏在橱柜内。

企业 LAN 服务器上的内部 Web PHP“应用程序”将与其电子商务和 UPS.com 协调来打印运输标签。我忘记了 UPS 是如何发送的,但我们使用 imagemagik 将最终图像调整到完美的像素宽度。然后 LAN 服务器将连接到目标的 php 套接字服务器,并将正确的命令连同图像数据一起发送到打印机所连接的串行端口

将该解决方案称为“madhatterey”是一种轻描淡写的说法……但令人惊奇的是,标签在“运送”订单时神奇地出现。没有打印对话框或任何东西。最便宜的解决方案是购买一个可以运行 Ubuntu 的 Atom 盒子,并购买一台带有 ppd 文件的打印机。然后正确排队即可。与 Linux 中的远程打印概念相同。

您可以从网页的 AJAX 请求执行打印请求,而不需要额外的基础设施(或目标计算机的 php 套接字服务器)。

I have done exactly this before. It was quite tricky, using a ubuntu server on the workplace's LAN and a thermal printer on another ubuntu computer in the shipping area. That computer was running a php service listening to a port and was headless, hiding inside the cabinetry.

The business's internal web php "application" on the LAN server would coordinate with their e-commerce and UPS.com to print a shipping label. I forgot how UPS sent it but we used imagemagik to tweak the final image to the perfect pixel width. Then the LAN server would connect to the target's php socket server and it would send the proper commands to the serial port that the printer was connected to, along with the image data.

To call that solution madhatterey is an understatement... but was quite amazing to have labels appear magically upon "shipping" an order. No print dialog or anything. Cheapest solution is get an Atom box that can run Ubuntu and get a printer with a ppd file that works. Then just queue it up properly. Same concept as remote printing in linux.

You could possibly do the print request from a webpage's AJAX request and not need the extra infrastructure (or target computer's php socket server).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文