views:

69

answers:

3

HI all

is there any kind of abstraction API over Apache POI/FOP allowing one to use the same API to write both Word and PDF documents ?

+1  A: 

I'm not aware of a unified API for the two libraries you have mentioned.

However you may still have a couple of options using a single API:

  • Use Apache POI to generate the documents in Word format and then use a Word to PDF conversion library to create a PDF from the word document. Another commenter has suggested IText
  • Use OpenOffice via its Java API to create documents and export them in Microsoft Word or PDF format.
BenM
Well, I would really want to avoid integration OpenOffice code in mine, since it seems a little heavyweight.
Riduidel
Yes I imagine it would be. I know Aspose.Words for Java <http://www.aspose.com/categories/java-components/aspose.words-for-java/default.aspx> has PDF export planned (in addition to existing word support) but it doesn't look like it's in the final product yet.
BenM
A: 

When I was working on previous project, I was sure the Apache/POI can be used for Microsoft Documents.

we have IText.jar which we can use it for PDF generation and alteration. please check this will help you.

harigm
+1  A: 

Docmosis will do what you require, assuming you mean a Java (or command line) API. It reads doc and odt files as templates, populates/manipulates via the Java API, and produces the output formats OpenOffice supports. Have a look at the online demo on the web site which lets you see various output formats to render a document in.

jowierun