

Product Page | Docs | Demos | API Reference | Blog | Free Support | Temporary License
GroupDocs.Viewer for Python via .NET is a document rendering API that displays 170+ file formats — DOCX, PDF, XLSX, PPTX, CAD drawings, email messages, archives, and more — as HTML, PNG, JPG, or PDF. It preserves layout and formatting while offering per-format rendering options.
Get Started
pip install groupdocs-viewer-net
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions
with Viewer("document.docx") as viewer:
options = HtmlViewOptions.for_embedded_resources("page_{0}.html")
viewer.view(options)
How It Works
The package is a self-contained Python wheel (~160 MB) that includes everything needed to render documents. No external software installation is required — just pip install and start viewing. The wheel works across Python 3.5 – 3.14 on Windows, Linux, and macOS (Intel + Apple Silicon).
Features
- Wide Format Support: 170+ file formats across Microsoft Office, PDF, images, CAD, email, and archives.
- Flexible Output: Render to HTML (embedded or external resources), PNG, JPG, or PDF.
- Page Control: Render whole documents, selected pages, page ranges, or reordered pages.
- Custom Streams: Route each page or resource to a Python-provided stream factory — no disk writes required.
- Cross-Platform: Windows x64/x86, Linux x64, macOS x64/ARM64.
Supported File Formats
For a complete list, see supported formats.
- Microsoft Office (Word, Excel, PowerPoint, Visio, Project, Outlook)
- PDF (Standard PDFs, PDF/A)
- OpenDocument (ODT, ODS, ODP)
- Images (JPEG, PNG, TIFF, BMP, SVG, WebP, DICOM)
- Email (EML, MSG, PST, OST)
- eBook (EPUB, MOBI, AZW3)
- Archives (ZIP, TAR, RAR, 7Z)
- AutoCAD (DWG, DXF, DGN, IFC)
- Web (HTML, MHTML, CHM, XML)
Examples
Render DOCX to HTML (embedded resources)
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions
with Viewer("./document.docx") as viewer:
viewer.view(HtmlViewOptions.for_embedded_resources("./out/page_{0}.html"))
Render selected pages to PNG
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import PngViewOptions
with Viewer("./document.pdf") as viewer:
viewer.view(PngViewOptions("./out/page_{0}.png"), page_numbers=[1, 3, 5])
Render with Advanced Options
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions, LoadOptions, Watermark
load_options = LoadOptions()
load_options.password = "12345"
with Viewer("./protected.docx", load_options) as viewer:
options = HtmlViewOptions.for_embedded_resources("./out/page_{0}.html")
options.watermark = Watermark("CONFIDENTIAL")
options.render_responsive = True
viewer.view(options)
Get View Info
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import ViewInfoOptions
with Viewer("./document.pdf") as viewer:
info = viewer.get_view_info(ViewInfoOptions.for_html_view())
print(f"Pages: {len(info.pages)}")
Render from Stream / BytesIO
import io
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions
with open("document.docx", "rb") as stream:
with Viewer(stream) as viewer:
viewer.view(HtmlViewOptions.for_embedded_resources("./out/page_{0}.html"))
buf = io.BytesIO(downloaded_bytes)
with Viewer(buf) as viewer:
viewer.view(HtmlViewOptions.for_embedded_resources("./out/page_{0}.html"))
Render to Custom Streams (no disk writes)
import io
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import PngViewOptions
pages: dict[int, io.BytesIO] = {}
def create_page(page_number):
pages[page_number] = io.BytesIO()
return pages[page_number]
with Viewer("./document.docx") as viewer:
viewer.view(PngViewOptions(create_page))
AI Agent & LLM Friendly
This package is designed for seamless integration with AI agents, LLMs, and automated code generation tools.
Evaluation Mode
The API works without a license in evaluation mode with the following limitations:
- A watermark is added to rendered output.
- Only the first few pages are rendered.
To remove these limitations, apply a license or request a temporary license:
from groupdocs.viewer import License
License().set_license("path/to/license.lic")
Or set the environment variable (auto-applied at import):
export GROUPDOCS_LIC_PATH="path/to/license.lic"
Troubleshooting
System.Drawing.Common is not supported | Linux/macOS | apt-get install libgdiplus (Linux) or brew install mono-libgdiplus (macOS) |
| Garbled text or missing fonts in rendered HTML/PDF | Linux | apt-get install ttf-mscorefonts-installer fontconfig && fc-cache -f |
The type initializer for 'Gdip' threw an exception | macOS | brew install mono-libgdiplus |
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT errors | Linux | Do NOT set this variable. ICU must be available. |
System Requirements
- Python 3.5 - 3.14
- Windows x64/x86, Linux x64, macOS x64/ARM64
More Resources
Also available for other platforms:
.NET | Java | Node.js
Product Page | Docs | Demos | API Reference | Blog | Free Support | Temporary License