Skip to content

Instantly share code, notes, and snippets.

@groupdocs-com-kb
Last active October 31, 2025 18:14
Show Gist options
  • Save groupdocs-com-kb/db1e3a124e6aaa594ce30e5310904324 to your computer and use it in GitHub Desktop.
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/
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