Skip to main content

printerJob.printDialog Help

1 reply [Last post]
Joined: 2007-12-23

Is there a way to change to default margins in the "Page Setup" dialog from the default
of 1 inch. I notice for a given printer that if I zero out the top, bottom,left,right margins to
zero, they will snap to what the minimum margin can be set to for a given paper size.
Is Java's (1 inch) default just very conservative ?,Iis there a way to have it default to
the max imageable area ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-05-04

Yes, but it is little hiden:
You must call print passing a HashPrintRequestAttributeSet with MediaPrintableArea.

PrinterJob pj;
HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet();
as.add(new MediaPrintableArea(x, y, width, height, MediaPrintableArea.MM));