API To convert a file to PDF

I want some API and some doc. So I can convert any file to PDF .
The file can be Doc , exl, ppt ..etc


My requirement: I have an EX: - Doc file and I just want to convert it to PDF .. using java. Any suggestion would be helpful ...


source to share

5 answers

Apache poi

API is best to convert any file to pdf



I would recommend that you take a look at Flying Saucer (formerly xhtmlrenderer), which makes creating PDFs extremely easy from XML and HTML files (it uses iText internally).

HTML / XML can be used as an intermediate format, which makes it quite flexible.





If you want to generate a PDF document from an XML document, you can try Apache FOP, which follows the XSL-FO standard.


So the smart process could be: extract data from different document formats using POI, odftoolkit (for OenDocument) or other tools, inject it into an XML container, and then convert it to PDF using FOP.



You can use Itext . It is well documented and contains tons of examples.



All Articles