File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Printing Labels in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Printing Labels in Java" Watch "Printing Labels in Java" New topic

Printing Labels in Java

Dave Matthews

Joined: Jun 11, 2002
Posts: 15
I am trying to print out envelope labels via a Java app, I can get it to print out an address on a normal sheet of A4. However envelopes get loaded into the printer length-ways so when the address is printed out it is printed out at 90 degrees to the way it should be.
Does any Java genius know how to spin the text I want to print 90 degrees so that the address is printed correctly or is there another way of printing envelope labels correctly?
Gillian Bladen-Clark

Joined: Dec 13, 2003
Posts: 18
I found the javax.print.attribute.standard which has an OrientationRequested class described in the API. I haven't used this myself so I can't help further but it looks a likely candidate for what you need.
Dave Matthews

Joined: Jun 11, 2002
Posts: 15
Hmmm, I tried setting the orientation, because as you said it seems to be the way to go but had no joy.
Does anyone else have any ideas?
Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
We print specialized labels through a Java applet, and we always write the text to an image before sending it to a printer (it might be easier for you to manipulate). I just found this with Google:
Here's an article where they mention rotating text in Java:
I agree. Here's the link:
subject: Printing Labels in Java
It's not a secret anymore!