Using the same API to write both Word and PDF documents

天大地大妈咪最大 提交于 2019-12-13 01:04:19

问题


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:


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.



回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/2727993/using-the-same-api-to-write-both-word-and-pdf-documents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!