Create a virtual printer in Java
I would like to create a virtual printer using Java, so that when you go to print a file( using Word or something) the Java printer is listed as a valid printer. My goal is to get the printer formatted object that the programs (Word, etc..) send directly to the printer. I don't know if this is possible. It seemed like a more logical solution to this question:
Printing multiple file types using java
Any ideas? I heard thi开发者_StackOverflow社区s is only possible using C or C++, but I don't know for sure.
There is a LPD implementation available in Java. You can then create manually a printer in Windows which use the LPR protocol to print to said Java LPD. This captures the result as a byte stream which you can then manipulate further.
You will have to write a new printer driver that re-direct API calls to your Java classes.
RedMon
You could use RedMon to pipe the printed output into a Java program. Together with a Standard postscript driver this would give you Postscript that can be read and post-processed by your Java program.
The RedMon port monitor redirects a special printer port to a program. RedMon is commonly used with Ghostscript and a non-PostScript printer to emulate a PostScript printer.
RedMon can be used with any program that accepts data on standard input.
精彩评论