[Advanced-java] RTF to BMP
Dennis Sosnoski
dms at sosnoski.com
Tue Jun 24 16:40:37 2003
You can do this using a javax.swing.JEditorPane component. Render it to
a buffer by first creating a java.awt.image.BufferedImage of the
appropriate size and depth, then get the java.awt.Graphic2D from the
BufferedImage and pass it in a call to the paintAll method of the
component. Once you've got the buffered image you can use
com.sun.image.codec.jpeg.JPEGImageEncoder to convert it to a JPEG, or
massage it into form to be used by one of the APIs available for writing
BMP.
Warning: many aspects of this type of operation are kludgy and/or
broken, especially if you're doing this server side with a headless
display. Support seems to be gradually improving.
- Dennis
Dennis M. Sosnoski
Enterprise Java, XML, and Web Services Support
http://www.sosnoski.com
Redmond, WA 425.885.7197
Walter do Valle wrote:
>I need to create a program that reads a RTF file and gives me a BMP (or other known image format).
>Does anyone know any component or other thing that makes this?
>Any help is welcome.
>
>Thanks
>
>Walter do Valle
>_____________________________________________________
>Sun Certified Programmer for the Java 2 Platform
>http://www.softplan.com.br
>_____________________________________________________
>
>