Skip to main content

GroupDocs.Viewer for Python via .NET - Render 190+ file formats to HTML, PNG, JPG, or PDF

Project description

banner

PyPI PyPI - Python Version

Product Page | Docs | Demos | API Reference | Blog | Free Support | Temporary License

GroupDocs.Viewer for Python via .NET is a document rendering API that displays 190+ 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: 190+ 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.

Common Tasks

  • Render DOCX, PDF, XLSX, or PPTX to HTML for an in-browser document viewer
  • Generate per-page PNG or JPG thumbnails and previews
  • Produce a print-ready PDF from any supported format
  • View CAD drawings (DWG, DXF) without AutoCAD
  • Display email messages (MSG, EML) together with their attachments
  • Render specific pages, page ranges, or reordered pages
  • Feed rendered HTML or page images into an AI / RAG document-preview pipeline

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)

Platform & Format Support

Format family Windows Linux / macOS
Project Management (MPP, MPT, MPX) Yes No
All other formats (Office, PDF, Visio, CAD, images, email, archives, eBooks, web, …) Yes Yes

The Linux/macOS build uses GroupDocs.Viewer.CrossPlatform, which renders every format except the Project Management family (MPP, MPT, MPX) — render those on Windows. Everything else, including Visio, works on all platforms.

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.md in 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 .md to any docs URL

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

groupdocs_viewer_net-26.5.0-py3-none-win_amd64.whl (170.8 MB view details)

Uploaded Python 3Windows x86-64

groupdocs_viewer_net-26.5.0-py3-none-macosx_11_0_arm64.whl (177.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

groupdocs_viewer_net-26.5.0-py3-none-macosx_10_14_x86_64.whl (179.9 MB view details)

Uploaded Python 3macOS 10.14+ x86-64

File details

Details for the file groupdocs_viewer_net-26.5.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for groupdocs_viewer_net-26.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5522edcba3f683a10bba1d87d9c99a05a342b224a4060559077196eef7e44057
MD5 15a47b4fa4005343d155d803b9fd117d
BLAKE2b-256 d7a944f9d9c7381b7076e7b664f007800b292ea4621eb42bfaa9df63c6fafbfb

See more details on using hashes here.

File details

Details for the file groupdocs_viewer_net-26.5.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for groupdocs_viewer_net-26.5.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 964285ea577b717787ea3a58bcae0de3cfca0cfedc4a40c98eb7ed297310d9d2
MD5 2373bcba8699a79e9323cbbd7538e05b
BLAKE2b-256 052a541fa8125ee61caec6207c44e64ac9e9b567aba6aa62a8111fb4876b9f50

See more details on using hashes here.

File details

Details for the file groupdocs_viewer_net-26.5.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for groupdocs_viewer_net-26.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5a3e96ca0948a346504096397830fbb42bd341b14cfc059dc673d05ddb77be63
MD5 c8b7177a2cf997000c05e96048be4d52
BLAKE2b-256 081f683eff599de288e56328ed4f6a3aca22326824720690d3089a606e1d42dc

See more details on using hashes here.

File details

Details for the file groupdocs_viewer_net-26.5.0-py3-none-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for groupdocs_viewer_net-26.5.0-py3-none-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 abedd90141d3557f5020eacd988cb999a624d5871b80eeb162984deddf9e7744
MD5 b974e3f3b4c9d8199520e97b21b5389d
BLAKE2b-256 0e3274ed824d4804f163dd207f3935f7f0cc08514d7c653004c4fc044a59fb4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page