RTF to PDF in Python

RTF format was introduced by Microsoft to create rich text documents. The interoperability offered by the RTF format allows you to exchange the content between different Microsoft products. However, often you have to convert RTF files to PDF before sharing. To achieve that, this article covers how to convert an RTF file to PDF in Python.

Convert RTF to PDF in Python - Library

To convert RTF files to PDF format, we will use Aspose.Words for Python. It is a powerful library to implement word-processing features from within your Python applications. Using this library, you can create and manipulate Word documents seamlessly. You can install the library from PyPI using the following pip command.

pip install aspose-words

How to Convert RTF File to PDF

Conversion of RTF documents to PDF using Aspose.Words is a piece of cake. The following are the steps that you need to perform for RTF to PDF conversion.

  • Load the RTF document by specifying its path.
  • Specify the converted PDF file’s path.
  • Save RTF document as a PDF file to the specified location.

Convert RTF to PDF in Python

Let’s now have a look at how to implement the above-mentioned steps to convert an RTF document to PDF using classes and methods of Aspose.Words.

  • Load the RTF document using Document class.
  • Convert RTF to PDF using Document.save(string, SaveFormat) method.

Python Code to Export RTF to PDF

The following code sample shows how to convert an RTF file to PDF format.

The following is the screenshot of the input RTF document that we used in this example.

Document for RTF to PDF Conversion

RTF Document

The following screenshot shows the converted PDF document.

RTF to PDF Conversion using Python

Converted PDF Document

Save RTF to PDF with a Free License

You can get a free temporary license to convert RTF files to PDF without evaluation limitations.


In this article, you have learned how to convert RTF files to PDF format in Python. You can install the said library in your applications and integrate the provided code to automate RTF to PDF conversion. In addition, you can explore other features of Aspose.Words for Python using the documentation. Also, you can post your questions on our forum.

See Also