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!
CongUanAsked:
Who is Participating?
 
hoomanvCommented:
java.awt.print.Paper.setImageableArea(double x, double y, double width, double height) could be a solution
because PageFormat will get the page coordinate info from the Paper object associated to it
0
 
hoomanvCommented:
and then pageFormat.setPaper(yourCustomizedPaper)
0
 
WebstormCommented:
also use Paper.getHeight() .getWidth() to call setImageableArea
default margins are 1 inch (72pt)
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
CongUanAuthor Commented:
Yah, Thanks very much.
0
 
hoomanvCommented:
CongUan ... how come you didn't select my answer which was first and the same as Webstorm
http://www.experts-exchange.com/help.jsp#hi68
0
 
WebstormCommented:
>> 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.
0
 
hoomanvCommented:
the main solution with needed steps was provided by me
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.