Java - PrinterJob

I'm Simply using PrinterJob but it gives the landscape print in portrait orientation, also it crops the overflowing image... too much margins... so how to make all this correct? it should automatically determine the orientation, also do not crop the image... and should give less margin on A4 Sheet...

30th Mar 2017, 6:26 PM
Ammy Dua
Ammy Dua - avatar
1 Answer
+ 9
You need the class PageFormat You could call the method printDialog of PageFormat which shows a dialog where you can change the properties. Another option is to use setOrientation(PageFormat.PORTRAIT). And then set this PageFormat to the PrinterJob.
6th Apr 2017, 4:51 AM
Tashi N
Tashi N - avatar