-->

How to intercept data being sent to a printer?

2019-02-20 20:16发布

问题:

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?

回答1:

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/