Last active
October 31, 2025 18:15
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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