File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes RTF to PDF Conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "RTF to PDF Conversion" Watch "RTF to PDF Conversion" New topic

RTF to PDF Conversion

anish arora

Joined: Nov 13, 2008
Posts: 4

I am trying to convert rtf document to pdf in my web application.I am using the RTFToolkit present in jdk swing for reading rtf.The problem is it is not able to read the table data properly in rtf file due to which the PDF document created is missing the table data.Is there any to do it ?

I am doing as follows

read rtf (using rtftoolkit) --> construct a pdf using apache FOP or iText.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Welcome to JavaRanch.

I doubt that RTFToolkit supports anything close to the full range of RTF features. Aside from rolling your own RTF reader (it's not that hard to create a lexer for RTF) which then creates PDF, you could check out OpenOffice's server mode. It has a Java API you could use to have it open an RTF file, and then save that as PDF.
anish arora

Joined: Nov 13, 2008
Posts: 4
Hi Ulf

I checked the open office converter api it says we can convert from ms word,excel or ppt to any of PDF,RTF etc but not from RTF to PDF.The RTF Conversion looks little bit tricky do you have any other suggestions ?

anish arora

Joined: Nov 13, 2008
Posts: 4
sorry ulf my bad it looks like it has one.
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

That's interesting to know, that OO API sounds more useful than I originally thought!

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
anish arora

Joined: Nov 13, 2008
Posts: 4
Hi Ulf,

I tried with the Open office converter but looks like the application is not scalable for my current application(environment problems)I tried with different api's which convert rtf to xsl-fo and from there to pdf using apache fop.but still my table strutures are scrambled up.are you aware of any open source api's which are helpful ?Can you piont me to any resources which can help me read rtf tables.
Suresh Pagadala

Joined: Dec 26, 2008
Posts: 1
Originally posted by Suresh Pagadala:

Hi Anish,

I found Open Office to be good enough for converting RTF to PDF format. However, you had mentioned that this is not scalable as per your environment. Could you please provide some additional information on this? What kind of scalability issues did you face?
Thanks in advance.
Dan Chirita

Joined: Oct 22, 2009
Posts: 2

You can convert RTF to PDF using JODConverter (opensource, using openoffice in background)
I've never used it but it shouldn't be difficult to use.

I agree. Here's the link:
subject: RTF to PDF Conversion
It's not a secret anymore!