• Post Reply Bookmark Topic Watch Topic
  • New Topic

javax.print

 
Rish Khopkar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way in the javax.print API to specify the length of the right, left, top and bottom margins? If so what is it?
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rish:
Welsome to JavaRanch. As far as I can tell, setting your margins is something that you have to do in your document that you are printing -- since the document has to be abl to format itself, it needs to know the margins.
Alternatively, you might look at setting the Media Printable Area attribute. It will allow you to position the x,y position on the media where printing starts, but it only effectively sets the top and left margins; the right and bottom are still document-dependent.
[ October 21, 2003: Message edited by: Joel McNary ]
 
Rish Khopkar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, Actually right after posting this question, I looked at the API and tried out the MediaPrintableArea and got it to work. Unfortunately, it is not a very clean way to do it, and I had to hack around and change the size of the Printable area to be much larger than that of my document, and do some other positioning magic to get it to work.
Thanks for your reply.
I see what you're saying, but it seems like it wouldn't hurt to have a clear way of saying through the API that my left margin is x inches, my right margin is y inches, my top margin is p inches and my bottom margin is q inches.
Amarish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!