Newer XPS print drivers (almost all Windows 8 print drivers) require DOCINFO.pDataType = "XPS_PASS" (instead of "RAW") to pipe raw print jobs (Postscript/PCL/ZPL/etc).
(Send Postscript Document to Printer using VC++)
(How to make RawPrinterHelper work in both XPS_PATH and RAW data types?)
Other than using something like JNA, is there a way to do this in a Java applet/application?
I can use JNA, and plan to use it for printer management, but I'd rather the actual printing not have to delve into JNA - Win32 API territory.
NOTE: I also want to avoid having to pipe directly to 9100, serial ports, etc. Makes more sense to make use of already detected/configured printers.
WORKAROUND: I've had success using JNA and JOB_INFO to send "XPS_PASS". Can use PRINTER_INFORMATION_4 and DOCINFO_4/DOCINFO_8 (implement structs yourself) to detect if XPS_PASS or RAW should be sent. See C++ examples
JNI is the only choice right now. Should probably be filed as a bug report to Java issue tracker.
JDK8 source: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/windows/native/sun/windows/WPrinterJob.cpp#l999
JDK9 source: http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/c0ed608fc7d2/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp#l1060
Unfortunately, it is not possible as the DOCINFO.pDataType is hardcoded to "RAW", and there does not appear to be any other entrypoints to printing in the JVM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With