Skip to content

Instantly share code, notes, and snippets.

@groupdocs-com-kb
Last active October 31, 2025 18:15
Show Gist options
  • Save groupdocs-com-kb/c0080ce3ee5646f08707bdc5eb27b83c to your computer and use it in GitHub Desktop.
Save groupdocs-com-kb/c0080ce3ee5646f08707bdc5eb27b83c to your computer and use it in GitHub Desktop.
Render RTF as JPG using Python. For more information, please follow link: https://kb.groupdocs.com/viewer/python/render-rtf-as-jpg-using-python/
import groupdocs.viewer as gv
import groupdocs.viewer.options as gvo
# Load the RTF document from the specified file path
with gv.Viewer("./input.rtf") as viewer:
# Create options to render each page of the document as a JPG image
# The {0} placeholder will be replaced by the page number (e.g., output_1.jpg, output_2.jpg)
viewOptions = gvo.JpgViewOptions("output_{0}.jpg")
# Render all pages of the RTF document into separate JPG images
viewer.view(viewOptions)
print("RTF pages have been successfully rendered to JPG images.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment