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
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.
Joined: Jul 13, 2001
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 ]
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.