4

I want to convert RTF file to PDF using java library. What are good open source java libraries which can be used to convert RTF to PDF file?

I don`t want to use OpenOffice JodConverter library as we need to setup openoffice software and start its service externally.

I also checked docx4j library which converts DOCX file to PDF very well, but I could not figure out how to convert RTF to PDF?

If there is any library which can help converting RTF to DOCX then also it will be helpful. So later I can convert generated DOCX to PDF using a docx4j library.

Note: I want library which does not depend on external software or tool.

2

I would suggest you take a look at iText for Java. It’s an open source library that can be used to do what you’re asking. In fact, there’s an example blog post that explains how to convert RTF to PDF using iText.

  • 1
    iText is not a free library, we need to purchase commercial license for it. Also iText don't convert RTF to PDF properly, i.e., RTF containing tables, Some Fonts, Background colour etc are not transported properly in final PDF using iText – Nirav Patel Dec 3 '15 at 2:40
  • Part of the above comment is wrong: The RTF function was part of itext 2.X which is licensed under MPL/LGPL (so "free" in that sense if you obey the license). In todays commercial iText there is no RTF functionality... – Lonzak Apr 19 '18 at 15:54
1

If a commercial SDK is an option for you, you can check out the LEADTOOLS Document Converter. Disclaimer: I am an employee of this product

The Document Converter SDK from LEADTOOLS lets you convert to and from any document or raster image format such as:

  • Adobe Acrobat PDF and PDF/A
  • Microsoft Office DOC/DOCX, XLS/XLSX, PPT/PPTX, PST, EML, MSG, and XPS formats
  • CAD formats such as DXF, DWG, and DWF
  • TIFF, JPEG, PNG, EXIF, BMP, and hundreds more raster image formats
  • Plain Text, RTF, HTML, MOBI, ePUB, and more
  • IBM AFP, MO:DCA, IOCA, and PTOCA

There is also a free 60-day evaluation so that you can try it out before purchasing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.