打印到 UPS / Fedex 热敏打印机?
我有一位客户询问他们的 Web 应用程序 (PHP) 是否可以轻松打印到 UPS/Fedex 热敏标签打印机。
例如,我可以从 UPS/Fedex 取回带有运输标签的 PDF。我只需要打印它。
有谁知道您是否可以直接打印到这些打印机,或者如果不能,是否有其他方法可以做到这一点?
编辑:为了澄清,我想要完成的就是能够打印到这些打印机,而不必让我的客户端 ALT-TAB 到某些第三方应用程序,如 UPS Worldship 或 ShipRush 或 QuickBooks Shipping Manager,然后单击“打印”该应用程序。可行吗?
I have a client asking if their web application (PHP) can easily print to a UPS / Fedex thermal label printer.
So for instance, I can get back a PDF from UPS/Fedex with the shipping label. I just need to print that.
Does anyone know if you can print directly to these printers or, if not, if there's another way to do it?
EDIT: To clarify, all I want to accomplish is to be able to print to these printers, without having to make my client ALT-TAB to some third-party application like UPS Worldship or ShipRush or QuickBooks Shipping Manager and clicking 'Print' within that application. Do-able?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
有关如何打印的最佳信息来源将来自打印机制造商的网站。我过去在为使用 UPS API 的客户开发解决方案时参考过这篇文章。
发送原始数据EPL2 通过 C# 直接连接到 Zebra LP2844”。
这篇博文详细介绍了从代码打印标签。不要被吓到,因为它的标题中有 C#。
制造商在提供您需要的信息。
Your best source of information on how to print will come from the printer manufacturors web sites. I have referred to this article in the past when developing solutions for customers that consume the UPS API's.
Sending Raw EPL2 Directly to a Zebra LP2844 via C#".
This blog post goes into good detail about printing labels from code. Dn't be scared off because it has C# in it's title.
The manufacturers do an okay job of providing the information you need.
Shiprush 有一个 API,可用于从代码生成标签。它非常灵活,可以将标签发送到打印机,也可以将标签返回到您的代码以供您处理。
Shiprush has an api you can use to generate labels from code. It is pretty flexible, and can either send the label to a printer or return the label to your code for you to handle.
这个开源小程序允许您从 PHP 进行打印。我个人远离 Java,但它可能会起作用。
http://code.google.com/p/jzebra/
This open source applet would allow you to print from PHP. I personally stay away from Java but it may do the trick.
http://code.google.com/p/jzebra/
您将无法将承运商 PDF 打印到设备,但是您可以从承运商获取原始 EPL/ZPL 代码并将其发送到打印机。
您可以安装 UPS 提供的 ActiveX 控件。如果您使用 MIME 类型的应用程序/epl2 返回 EPL 流,ActiveX 控件将获取数据并将其发送到热敏打印机。
谷歌“ups heat activex”
You will not be able to print the carrier PDF to the device, however you can take the raw EPL/ZPL code from the carrier and have that sent to the printer.
There is an ActiveX control from UPS that you can install. If you return the EPL stream with a MIME type of application/epl2 the ActiveX control will take the data and send it to the thermal printer.
Google "ups thermal activex"
以正确的格式获取标签
UPS API 提供获取热敏标签特定类型的选项。您会在键盘上敲打键盘,试图让 PDF 在热敏打印机上正确打印。
一些常见的热敏类型EPL/EPL2、ZPL/ZPLII。大多数热敏打印机都会接受与这些类型之一匹配的文档。
对于 FedEx,您的 ShipRequest 中类似这样的内容 - 这是使用 FedEx WSDL 进行运输。
和 UPS - 构建 XML 以发布到 UPS 服务。
打印标签
您实际上需要将“原始”数据发送到打印机。我从这篇文章开始并将其采纳到我的解决方案中。例如,FedEx 返回一个包含标签信息的字节数组 - 我将其转换为字符串,然后发送到打印机。
http://www.paulaspinall.com/post/2008/05/31/Sending-data-direct-to-a-printer.aspx paulaspinall.com/post/2008/05/31/Sending-data-direct-to-a-printer.aspx
SO 上还有另一个关于此主题的线程。
将原始数据发送到 FedEx 标签打印机
Getting the labels in correct format
The FedEx & UPS APIs provide options to get thermal label specific types. You will beat your head on the keyboard trying to get PDFs to print properly on thermal printers.
Some common thermal types EPL/EPL2, ZPL/ZPLII. Most thermal printers will accept documents matching one of these types.
For Fedex something like this in your ShipRequest - This is using the FedEx WSDL for shipping.
And UPS - Building XML to post to the UPS service.
Printing the labels
You will need to essentially send "raw" data to the printer. I started with this article and adopted it to my solution. FedEx for example returns a byte array which contains the label information - I convert this to a string and then send to the printer.
http://www.paulaspinall.com/post/2008/05/31/Sending-data-direct-to-a-printer.aspx
There is also another thread on SO about this topic.
Sending raw data to FedEx Label printer
我曾经在 UPS 运输系统上工作,是的,您可以使用热敏打印机进行打印。您需要安装正确的驱动程序才能执行此操作。根据您想要的打印方式,还决定了您需要如何安装打印机(本地或共享打印机)。华泰
I used to work on UPS shipping systems and yes you can print using the thermal printers. You need the correct drivers installed to do this. Depending how you want to print will also determine how you need to install the printer (local or shared printer). HTH