使用相同的API编写Word和PDF文档

问题描述:

大家好

在Apache POI /

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 ?

我不知道您提到的两个库的统一API.

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

但是,使用单个API可能仍然有一些选择:

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

  • 使用Apache POI生成Word格式的文档,然后使用Word至PDF转换库从Word文档创建PDF.另一位评论者建议 IText
  • 通过Java API使用 OpenOffice 来创建文档并导出它们为Microsoft Word或PDF格式.
  • 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.