File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes Convert rtf File to jpg File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Convert rtf File to jpg File" Watch "Convert rtf File to jpg File" New topic
Author

Convert rtf File to jpg File

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1446
    
    1
Is there any way, using Java, to convert a rtf file to a jpg file on the fly?

My web app shares a set of files with a Windows app. The windows app displays the rtf in an ole box on a report when viewed.

I am using JasperReports to generate a PDF file for report viewing and printing. I cannot find a way to attach the rtf to the JasperReport. I know it can handle images so i thought that if I could convert rtf to jpg on the fly it might solve my issue. Right now at least on the view part I append a HyperLink to the rtf but this is not the users expectations.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1446
    
    1
I sure could use some direction for this issue.
Jeremy Botha
Ranch Hand

Joined: Feb 16, 2005
Posts: 125
RTF is a text format, isn't it?

About the only thing I can imagine you could do is use the java printing API to print to a PDF, and then convert the PDF to an image somehow.

But it seems like an incredibly round-about way to go about it.

Can you not access the data from which the RTF was generated?

J


McFinnigan? Never heard of him. Nobody here but us chickens...<br /> <br />SCJP for Java 1.4<br />SCJD for Java 5.0
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41800
    
  62
The best I can think of is to display the RTF in a Swing component (the class is called RTFEditorKit), and then to take a screenshot using the Robot class. I'm not sure that that would work on a server, or that the screenshot would include the parts not visible in the Swing window, but it might be worth a try.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert rtf File to jpg File