Link to home
Start Free TrialLog in
Avatar of CongUan
CongUan

asked on

How to set Margins when print with JAVA

Hi Experts,
I need to set page format Margins as below
 TopMargins=1
 LeftMargins=0
 RightMargins=0
 BottonMargins=1
 Gutter=0
I have not used PageDialog to set this, just want set this in the code not use pageFormat = printJob.pageDialog(pageFormat);

But I don't know how to set this wiht PageFormat object in code JAVA.

Please let help me with this.

Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of hoomanv
hoomanv
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
and then pageFormat.setPaper(yourCustomizedPaper)
Avatar of Webstorm
Webstorm

also use Paper.getHeight() .getWidth() to call setImageableArea
default margins are 1 inch (72pt)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CongUan

ASKER

Yah, Thanks very much.
CongUan ... how come you didn't select my answer which was first and the same as Webstorm
https://www.experts-exchange.com/help.jsp#hi68
>> the same as Webstorm
Where did you give those url ?
But i agree you should have received points (maybe a split), and wit h A-grade.
the main solution with needed steps was provided by me