Last active
October 31, 2025 18:14
-
-
Save groupdocs-com-kb/db1e3a124e6aaa594ce30e5310904324 to your computer and use it in GitHub Desktop.
Render RTF as HTML using Python. For more information, please follow link: https://kb.groupdocs.com/viewer/python/render-rtf-as-html-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 input RTF document for rendering | |
| with gv.Viewer("./input.rtf") as viewer: | |
| # Create HTML view options to generate HTML files with embedded resources (CSS, images, etc.) | |
| # The {0} placeholder is replaced by page numbers during rendering. | |
| viewOptions = gvo.HtmlViewOptions.for_embedded_resources("./page_{0}.html") | |
| # Render the RTF document into HTML format using the specified options | |
| viewer.view(viewOptions) | |
| print("RTF has been successfully rendered to HTML format.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment