This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi , I am running a web application on linux and need some conversion tools or mechanism for converting a word document to pdf format.
I had a look at apache fop,itext but these need the input inform of xml,meaning i had to manually input all the word document data into xml and then had to process the xml for pdf generation. Is there a direct way to convert the word document into PDF for web application?
Reading word files is general is tricky. The POI library can extract text from doc files, which could be used to create a PDF using iText.
An alternative would be to use the OpenOffice Java API to open the doc file and save it as PDF.
The AccessingFileFormats FAQ page has links to these (and other) libraries useful for dealing with various file formats.
Joined: Mar 06, 2002
Thank you for the response. I have a doubt..
iText is used for handling editable PDF. Does iText work similar to FOP?? i,e we need to pass the xml template along with the xsl style sheet which will be transformed or rendered into PDF generation using the iText library??
Joined: Mar 22, 2005
iText does not use XSL; it is a Java API for creating PDF documents. If you want it to handle XML files, then you have to read the XML in your code, and hand it to the API in appropriate chunks. The iText web site has plenty of examples of how it works in general, including an example of how to use XML as input.