IRONSOFTWAREHOME
RTF to PDF


import com.ironsoftware.ironpdf.PdfDocument;
import java.io.IOException;
import java.nio.file.Paths;

// Case 1: Generate a PDF from a string of Rich Text Content
try {
    String content = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\nouicompat\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Calibri;}}\n" +
            "{\\*\\generator Riched20 10.0.22621}\\viewkind4\\uc1 \n" +
            "\\pard\\sa200\\sl276\\slmult1\\b\\f0\\fs160\\lang9 Hello, world!\\par\n" +
            "}\n" +
            " ";
    PdfDocument pdf = PdfDocument.renderRtfAsPdf(content);
    pdf.saveAs(Paths.get("assets/rtf_to_pdf.pdf"));
} catch(IOException exception) {
    exception.printStackTrace();
}

// Case 2: Generate a PDF from a RTF file located on a filesystem path
try {
    PdfDocument pdf = PdfDocument.renderRtfFileAsPdf(Paths.get("assets/test.rtf"));
    pdf.saveAs(Paths.get("assets/rtf_to_pdf_2.pdf"));
} catch(IOException exception) {
    exception.printStackTrace();
}
mvn install
RTF to PDF

RTF to PDF

Using IronPDF, you can convert your RTF (Rich Text Format) documents with embedded images into PDFs.

Convert rich-text content into PDF documents by invoking PdfDocument.renderRtfAsPdf. This method works with an RTF string or with an external file (specified as a Path or String). It returns a PdfDocument that you can further customize and then save with saveAs(...).

Be sure your RTF string is valid - renderRtfAsPdf will throw an IOException if it encounters formatting errors or unrecognizable elements.

How to Convert RTF to PDF in Java

  1. Add IronPDF to your project (e.g., via Maven):
  2. Use renderRtfAsPdf for RTF strings, or renderRtfFileAsPdf for files.
  3. Save the resulting PDF with saveAs(...).
Learn more about rendering RTF files to PDFs in Java
View on GitHub

Ready to Get Started?

Version:2026.8just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Java Maven Library for PDF
Install with Maven

Version: 2026.8

<dependency>
   <groupId>com.ironsoftware</groupId>
   <artifactId>ironpdf</artifactId>
   <version>2026.8.2</version>
</dependency>
https://central.sonatype.com/artifact/com.ironsoftware/ironpdf/2026.8.2
or
Java PDF JAR
Download JAR

Version: 2026.8

Manually install into your project