从 Firefox 自定义打印(仅限 Windows)

发布于 2024-09-30 14:11:12 字数 751 浏览 4 评论 0原文

我创建了一个 .NET Windows Forms 组件,该组件通过 标签在 IE 中运行,并允许我使用 Windows API 直接从网页打印到热敏标签打印机驱动程序并发送原始命令。

这一切都有效,但我的客户现在要求 Firefox 提供类似的功能!

我需要做的是能够传递我想要使用的打印机的名称(这是在 Web 应用程序中配置的),然后传递一个直接发送到打印机而不被驱动程序拦截的字符串翻译。我可以通过访问以下 Win32 API 来实现所有这些(正如我目前从 .NET 组件所做的那样)...

  • OpenPrinter
  • StartDocPrinter
  • StartPagePrinter
  • WritePrinter
  • EndPagePrinter
  • EndDocPrinter
  • ClosePrinter

我已经查看了这些选项,据我所知唯一可用的路径是 XPCOM。任何人都可以告诉我在开始这条道路之前我是否已经得出了正确的结论,因为创建 XPCOM 扩展似乎涉及大量工作,而且我不想在上面花费大量时间只是为了发现要么...

  • 有一个更简单的方法
  • XPCOM 不会做我想做的事!

提前致谢。

顺便说一句:我不希望现有的 .NET 组件能够在 Firefox 中工作,我相信我必须从头开始并创建一个可以使用的 Firefox 扩展。

I have created a .NET Windows Forms component that runs within IE via an <object /> tag and allows me to print to a thermal label printer directly from a web page using the Windows API's to bypass the driver and send raw commands.

This all works, but my customer is now asking for similar functionality from Firefox!

What I need to do is to be able to pass the name of the printer that I want to use (this is configured within the web application) and then pass a string that is to be sent directly to the printer without being intercepted by the driver translation. I can acheive all of this by gaining access to the following Win32 API's (as I currently do from my .NET component)...

  • OpenPrinter
  • StartDocPrinter
  • StartPagePrinter
  • WritePrinter
  • EndPagePrinter
  • EndDocPrinter
  • ClosePrinter

I have looked at the options, and as far as I can see the only path available is XPCOM. Can anybody advise me as to whether I have reached the right conclusion before I start down this path as it appears that there is a great deal of work involved in creating an XPCOM extension and I would hate to spend a lot of time on it only to find out that either ...

  • There is an easier way
  • XPCOM will not do what I want!

Thanks in advance.

BTW: I am not looking to enable the existing .NET component to work in Firefox, I believe that I will have to start from scratch and create a Firefox extension that can be used instead.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文