on ‎2005 Aug 01 3:41 PM
Hello,
I am looking for a way to convert word files to pdf using Java. I am familiar with the jakarta POI project but unfortunally it doesn't contain this option. Does anyone have a sample code to do that?
Roy
Request clarification before answering.
Hi Roy,
this is a hard task. The problem is not only reading Word (POI's word API is somewhere between alpha and beta, it's not as good as the XLS-API, and at the moment, not under further development).
Some good source to look out for libraries for reading/writing different file formats is http://schmidt.devlib.org/java/document-libraries.html
Anyhow, when I had to convert Word into pure txt, I used StarOffice and it's Java API (not very comfortable, but possible). This is a way I would think about (you'd need StarOffice installed on the server). Maybe extracting to RTF before would bring you further, don't know...
As said, a hard task...
Hope it helps
Detlev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Detlev,
I think I found good library to do that, it is called iText: http://www.lowagie.com/iText/docs.html.
I will investigate it and let you know...
Cheers,
Roy
Hi Roy,
from the FAQ:
> Can I convert WORD doc-files or RTF to PDF using iText?
>
> No, iText is only able to generate RTF.
> It doesn't do RTF or Word-doc parsing. Try Apache POI.
At least, it would be a very hard task to support each Word feature manually into PDF creation.
I don't think that there is a comfortable way except really "printing" the PDF (of course, this should be done automatically, so this is the question if StarOffice or a third tool provide the API for this functionality).
Hope it helps
Detlev
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.