I'm writing a small printing application using javax.print. I'm very familiar with the Java Print Service, but I'm stumped, even after reading the source code of javax.print and sun.print. I want to display the native print properties dialog for the currently selected print service.
I've tried out all the variations of print dialogs that come with Java: ServiceUI.printDialog(...), PrinterJob.pageDialog(PageFormat), PrinterJob.pageDialog(PrintRequestAttributeSet), PrinterJob.printDialog(PrintRequestAttributeSet), PrinterJob.printDialog(). and ServiceUIFactory.getUI(...). None of these directly opens the native print properties window. I found that PrinterJob.pageDialog(PageFormat) displays a Java "Page Setup" dialog with a "Printer..." button that opens what appears to be a native printer select dialog. This, probably native, printer select dialog has a "Properties..." button that opens the native printer setup dialog that is installed with the printer driver.
I would like to directly open the native printer setup dialog that comes with the driver, without first having to open the previous two dialogs. Does anyone know how to do this?
You can write a VBS script to file and execute it. Oversimplified example:You'll probably want to add to the script to write the selected properties to stdout in a format that your Java program can read and use.
Can I write the VBS command to open the dialog for a print service that I specify? The currently selected printer is in an observer's subject in my Java code.
That would be a topic for a VBS forum , I would think. edit: On the Java side, you would want to pass a parameter to the script to specify the printer. Note: I don't know enough VBScript to even know if that's possible (identifying the printer, that is -- a parameter can certainly be passed).
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com