I have a printjob set up that is working with one problem.
While the layout is landscape the target printer orientation is portrait by default. The user has to remember to switch it to landscape. Short of generating a reminder message during the print dialog, is there not a way to force the print driver to use landscape rather than the default? TIA.
This is not an area I'm particularly experienced in so the following advice may or may not be useful.
Have you tried using the printDialog(PrintRequestAttributeSet attribs) method adding the OrientationRequested.LANDSCAPE attribute to the attribute set?
I am not having much success getting what I need. I was successful in implementing PageRequestAttributeSet. The page setup pops up with landscape selected, although I don't know why I need that since it is now selected. However, that does not help since the print services apparently ignore that. I then tried using PrintService and created a combobox so the user can select the printer in my application. Again that all works and the correct printer is selected when the print dialog comes up. Unfortunately the orientation is still the default rather than landscape. I now have 2 issues to over come. The first is to eliminate the page setup popup which is not needed even if it worked. The second is to set landscape orientation. FWIW, here is the new print class:
It may be that your printer ignores the orientation setting. If you get the PrintService object it has some methods for querying if the printer supports certain attributes and values. It may be worth checking to see if your print does support this although I would be surprised if any printer that can print landscape does not support the setting.
Bingo!!! That was it. However, I am still getting the print dialog which I neither need nor want. That only started happening when I added the PrintRequestAttributeSet code. Is there a way to eliminate it?