如何拦截发送到打印机的数据? [英] How to intercept data being sent to a printer?
问题描述
我正在与一个应用程序交互,该应用程序将原始打印机文件发送到默认打印机.这是它对数据所做的唯一处理.
I'm interfacing with an application that's sending a raw printer file to the default printer. This is the only thing it will do with the data.
我需要以某种方式获取此文件,以便我可以将其存储在其他地方.这样做的最佳方法是什么?
I need to get this file somehow so I can store it elsewhere instead. What would be the best way to do this?
我想到的最好的方法是编写一个监听特定端口的应用程序,并将默认打印机设置为该端口.
The best I've thought of is to write an app that listens to a specific port, and set the default printer to that port.
这种方式行得通吗?有没有更好的办法?
Would this way work? Is there a better way?
推荐答案
我遇到了 Java 的 LDP 实现,我将要修改和使用它.您可以将其作为打印机访问,然后使用原始文件执行您想要的操作.
I ran across and LDP implementation for Java that I'm going to modify and use. You can access it as a printer and then do what you want with the raw files.
http://lpdspooler.sourceforge.net/
这篇关于如何拦截发送到打印机的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!