在发送到 Zebra 打印机之前使用 .NET WinForm 打印预览 ZPL II 命令
我有一个 .NET Windows 应用程序,可以使用 ZPL II 或 EPL2 将命令打印到 Zebra 打印机。 有没有办法在直接从 Zebra 打印机打印之前打印预览表单中的数据?
I have an .NET Windows application that prints commands to Zebra printer using ZPL II or EPL2.
Is there any way to print preview the data in a form before printing it directly from Zebra printer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
查看 Labelary Web 服务,它允许您以编程方式将 ZPL 转换为图像。
只需构建一个包含要渲染的 ZPL 的 URL,从 Web 服务器获取图像,然后从应用程序内向用户显示该图像。
还有一个 ZPL 查看器,让您可以直接在网页上编辑和查看 ZPL。
Have a look at the Labelary web service, which allows you to convert ZPL to an image programmatically.
Just build a URL containing the ZPL that you want to render, get the image back from the web server, and show the image to the user from within your application.
There's also a ZPL viewer lets you edit and view ZPL directly on a web page.
我需要能够在我的应用程序中显示标签。所以我连接了 Fiddler 并弄清楚了获取标签图像的通信方式。
我在 LinqPad 中运行了它。 HTTP 的东西可以清理一下,但我想我应该发布代码供其他人使用:
这有以下参考文献:
和以下用途:
注意:我找不到与串行/非通信的方法IP 地址打印机。 (但这并不意味着没有办法。)
I needed the ability to show the label in my Application. So I hooked up Fiddler and figured out what the communication was to get the image of the label.
I got it running in LinqPad. The HTTP stuff can be cleaned up a bit, but I thought I would post the code for others to use:
This has the following References:
and the following Uses:
NOTE: I could not find a way to communicate with a serial/non-IP Addressed printer. (Though that does not mean that there is not a way.)
如果您可以使用 Chrome 插件,请尝试
Simon Binkert 的 Zpl 打印机。该插件基于之前评论中链接的 Labelary Web Service。
另请参阅:https://stackoverflow.com/a/33066790/3196753
注意,虽然此插件在 Google Chrome 内部运行,它可以与计算机上能够发送原始命令的任何应用程序一起使用。
它可以配置为侦听本地主机或专用 IP 地址,因此可用于在 PC 和本地网络上模拟 ZPL 打印机。如果您需要本地打印机或打印机共享,您可以在 PC 上设置一个原始打印机队列,该队列在主机名/IP 和端口上指向它,其他桌面应用程序将能够向其发送 ZPL。
请注意,如果您需要将其提供给网络上的其他计算机,请确保将打印机设置中的
127.0.0.1
更改为有效的 LAN IP 地址。If you're ok with using a Chrome Plugin, please try
Simon Binkert's Zpl Printer. This plugin is based on the Labelary Web Service linked in previous comments.
See also: https://stackoverflow.com/a/33066790/3196753
Note, although this plugin runs inside Google Chrome, it can work with any application on the computer capable of sending raw commands.
It can be configured to listen on localhost or dedicated IP address, so it can be used to emulate a ZPL printer on the PC and local network. If you need a local printer or printer share, you can set up a raw printer queue on the PC which points to it on hostname/ip and port and other desktop applications will be able to send ZPL to it.
Note, if you need to make it available to other computers on the network, make sure to change
127.0.0.1
in the Printer Settings to a valid LAN IP address.如果您不想将数据发送到云服务,您可以查看我们的项目,我们开发了一个开放的 ZPL 查看器,可以将 ZPL 数据转换为图形。该项目基于.NET。
更多信息可在此处获取 BinaryKits.Zpl.Viewer (GitHub)
还有一个 nuget 包 可用
示例代码
If you don't want to send your data to a cloud service you can have a look at our project we have developed an open ZPL viewer that converts ZPL data into a graphic. The project is based on .NET.
More Informations are available here BinaryKits.Zpl.Viewer (GitHub)
Also a nuget package is available
Example code
预览标签的唯一方法是在打印机的网页上。
如果您转到打印机的目录列表
http:///dir
并单击已保存的标签(或创建新标签),则可以单击“预览标签”
The only way to preview the label is on the printer's web page.
If you go to the printer's directory listing
http://<printer IP>/dir
and click on the saved label (or create a new one) then you can click"Preview Label"