aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Java Api for converting Word document to PDF? 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 "Java Api for converting Word document to PDF?" Watch "Java Api for converting Word document to PDF?" New topic
Author

Java Api for converting Word document to PDF?

Praveen Garimella
Greenhorn

Joined: Jul 17, 2003
Posts: 5
Hi,
I'm looking for a java api or open source components which can convert a word document into a PDF. I have an application where the users upload word documents and the upload servlet should be able to convert this word document into PDF.
Any one out there to help me out!
Praveen


Praveen Garimella
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I don't know any single library but you can use the POI library to read Office file formats and then use the iText library to transform your data into PDF.


GenRocket - Experts at Building Test Data
Detlev Beutner
Ranch Hand

Joined: Jul 13, 2001
Posts: 76
Hello Praveen,
like Gregg, I also don't know of such a library, and in addition, I do not believe that such a library exists. If you want the Word-doc directly converted into PDF, with the same layout, in fact you want to "print" the document to a PDF-destiller, PDF-Writer or such a thing.
A possibility could be to use OpenOffice; it has got Java-API's, and it's more secure than POI, which in fact is a bit alpha... Nevertheless, the OpenOffice Java API's are a bit confusing to handle with. There are some examples given, with these it is quite easy to convert for example .doc to .txt (and then using a PDF-Library). But again, that's not what you want, as far as I have understood.
Maybe the OpenOffice forums are a good place to ask some people there if the API's offer the possibility to "print" programmatically (to a destiller or such thing).
Hope it helps
Detlev
[ October 20, 2003: Message edited by: Detlev Beutner ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Well, if you choose to go the OpenOffice route, Oo1.1 has a PDF converter built in. So you don't have to mess with all the API stuff. Just click the PDF button on the tool bar, and it will prompt you to where you want to save the file as a PDF.
However, if you need to go the JAVA route programatically, then my option is the easiest one in my opinion.
 
jQuery in Action, 2nd edition
 
subject: Java Api for converting Word document to PDF?