GroupDocs.Viewer for Python via .NET - Render documents to HTML, PNG, JPG and PDF
Project description
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))
# pages now holds {1: <BytesIO>, 2: <BytesIO>, ...}
AI Agent & LLM Friendly
This package is designed for seamless integration with AI agents, LLMs, and automated code generation tools.
AGENTS.mdin the package — AI coding assistants (Claude Code, Cursor, GitHub Copilot) auto-discover the API surface, usage patterns, and troubleshooting tips from the installed package- MCP server — connect your AI tool to GroupDocs documentation for on-demand API lookups:
{ "mcpServers": { "groupdocs-docs": { "url": "https://docs.groupdocs.com/mcp" } } }
- Machine-readable docs — full documentation available as plain text for RAG and LLM context:
- Single file:
https://docs.groupdocs.com/viewer/python-net/llms-full.txt - Per page: append
.mdto any docs URL
- Single file:
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
| Issue | Platform | Fix |
|---|---|---|
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file groupdocs_viewer_net-26.4.0-py3-none-win_amd64.whl.
File metadata
- Download URL: groupdocs_viewer_net-26.4.0-py3-none-win_amd64.whl
- Upload date:
- Size: 170.8 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b2cd1a10bd94feaf12199876e53fc2a5a82eaf45dea8fb0f5690a875f0296d5
|
|
| MD5 |
f5fb4915ba62c59b4ed3a61b37f11364
|
|
| BLAKE2b-256 |
af74b521b226d1c8378859e15c8c0271e751c4c212947b6dddad24d7d77adaed
|
File details
Details for the file groupdocs_viewer_net-26.4.0-py3-none-manylinux1_x86_64.whl.
File metadata
- Download URL: groupdocs_viewer_net-26.4.0-py3-none-manylinux1_x86_64.whl
- Upload date:
- Size: 170.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9bc01338220e8d128eab4a9e5a650d29e5903f57e13d31d8557e9ba83705f20
|
|
| MD5 |
4d48b25a95c36f3881a9b8f3085c05ce
|
|
| BLAKE2b-256 |
61988982bfb4e2a45c62520786e9d5b0ab9f834ef42016960ef20a5f8836a038
|
File details
Details for the file groupdocs_viewer_net-26.4.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: groupdocs_viewer_net-26.4.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 169.9 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e70a917045e38bf00a5e17474587e6e65e9b6685d59c5daa7a98fcbd4b8d6718
|
|
| MD5 |
ef87006b92e2359aa10e9ae09431cb01
|
|
| BLAKE2b-256 |
7ba384e1f871f8f76abb5fda482063352d0a2f9c812980a5cab388a552c1d0c4
|
File details
Details for the file groupdocs_viewer_net-26.4.0-py3-none-macosx_10_14_x86_64.whl.
File metadata
- Download URL: groupdocs_viewer_net-26.4.0-py3-none-macosx_10_14_x86_64.whl
- Upload date:
- Size: 172.2 MB
- Tags: Python 3, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12427d988fec17816407a1a63bce724ea1023b4a67070a95d5281e431abdeb49
|
|
| MD5 |
18158a76b8d628cbfe73aa73714bccd1
|
|
| BLAKE2b-256 |
20e9cc0ab5909a8f22d285f4016883b75fc68eeed44f03f8fdaf54015cf9f130
|