Metadata-Version: 2.4
Name: groupdocs-viewer-net
Version: 26.11.0
Summary: GroupDocs.Viewer for Python via .NET - Render 190+ file formats to HTML, PNG, JPG, or PDF
Author-email: GroupDocs <support@groupdocs.com>
License-Expression: LicenseRef-Proprietary
Project-URL: Homepage, https://products.groupdocs.com/viewer/python-net/
Project-URL: Documentation, https://docs.groupdocs.com/viewer/python-net/
Keywords: viewer,render,view,document,pdf,docx,xlsx,pptx,html,png,image,groupdocs,dotnet
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: <3.15,>=3.5
Description-Content-Type: text/markdown
Requires-Dist: groupdocs-shared-net>=26.11.0

[![banner](https://raw.githubusercontent.com/groupdocs/groupdocs.github.io/master/img/banners/groupdocs-viewer-python-net-banner.png)](https://docs.groupdocs.com/viewer/python-net/)

[![PyPI](https://img.shields.io/pypi/v/groupdocs-viewer-net)](https://pypi.org/project/groupdocs-viewer-net/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/groupdocs-viewer-net)](https://pypi.org/project/groupdocs-viewer-net/)

[Product Page](https://products.groupdocs.com/viewer/python-net/) | [Docs](https://docs.groupdocs.com/viewer/python-net/) | [Demos](https://products.groupdocs.app/viewer/family) | [API Reference](https://reference.groupdocs.com/viewer/) | [Blog](https://blog.groupdocs.com/category/viewer/) | [Free Support](https://forum.groupdocs.com/c/viewer) | [Temporary License](https://purchase.groupdocs.com/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, renders to files or to memory, and its `groupdocs-viewer` command opens documents in the browser.

## Get Started

```bash
pip install groupdocs-viewer-net
```

```python
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 (about 175 MB on Windows, 185-190 MB on Linux and macOS) that bundles the .NET 10 runtime and everything else needed to render documents. No external software installation is required — just `pip install` and start viewing; pip also installs `groupdocs-shared-net`, the small package of modules every GroupDocs Python package shares. For an offline install, download both wheels and install them together: `pip install --no-index --find-links <folder> groupdocs-viewer-net`. 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.
- **Browser Viewer**: `groupdocs-viewer report.docx` opens a document, or a whole folder, in the GroupDocs.Viewer web UI on your machine — no web framework needed.
- **Cross-Platform**: Windows x64, Linux x64, macOS x64/ARM64.

## Common Tasks

- Render DOCX, PDF, XLSX, or PPTX to HTML for an in-browser document viewer
- Open a document or a folder of documents in the browser from the command line
- 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](https://docs.groupdocs.com/viewer/python-net/supported-document-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 |
|---|:---:|:---:|
| Photoshop (PSD, PSB) | Yes | No |
| Adobe Illustrator (AI) | Yes | No |
| OneNote (ONE) | Yes | No |
| All other formats (Office, PDF, Visio, Project, CAD, images, email, archives, eBooks, web, …) | Yes | Yes |

Windows wheels run the Windows build of the engine (`GroupDocs.Viewer.Net100.Windows`); Linux and macOS wheels run its cross-platform build (`GroupDocs.Viewer.Net100`), which renders every format **except** Photoshop (PSD, PSB), Adobe Illustrator (AI) and OneNote — render those on Windows. Visio and Microsoft Project (MPP, MPT, MPX) work on every platform; on Linux, Project files need the Microsoft core fonts (`ttf-mscorefonts-installer`).

## Examples

### Render DOCX to HTML (embedded resources)

```python
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

```python
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

```python
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

```python
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("Pages:", len(info.pages))
```

### Render from Stream / BytesIO

```python
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"))

with open("document.docx", "rb") as f:
    buf = io.BytesIO(f.read())   # e.g. bytes downloaded over HTTP
with Viewer(buf) as viewer:
    viewer.view(HtmlViewOptions.for_embedded_resources("./out/page_{0}.html"))
```

### Render to Custom Streams (no disk writes)

```python
import io
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import PngViewOptions

pages = {}  # page number -> 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>, ...}
```

### Cancel a Long Render

```python
from groupdocs.viewer import CancellationTokenSource, OperationCanceledError, Viewer
from groupdocs.viewer.options import HtmlViewOptions

source = CancellationTokenSource()
source.cancel_after(30)  # seconds; or source.cancel() from another thread
try:
    with Viewer("./large.xlsx") as viewer:
        viewer.view(HtmlViewOptions.for_embedded_resources("page_{0}.html"),
                    cancellation_token=source.token)
except OperationCanceledError:
    pass
```

The engine stops between pages of an HTML, PNG or JPG render. A PDF render, and a render of an
explicit page list, run to the end once rendering has started. To stop those, render in a worker
process started with `multiprocessing.get_context("spawn")`, and terminate it on timeout.

## View Documents in the Browser

The package installs a `groupdocs-viewer` command. It starts a small web server on your machine and opens the GroupDocs.Viewer UI in the browser: page navigation, zoom, rotation, thumbnails, search, print, PDF download and a dark theme. It needs nothing beyond the package. The address it prints and opens carries a session token (`http://127.0.0.1:8080/?token=...`), so other users of the machine and other websites cannot use the server; after a restart, open the new address.

```bash
groupdocs-viewer                          # browse the current folder
groupdocs-viewer ~/documents              # browse a folder and its subfolders
groupdocs-viewer report.docx              # open one file; nothing else is served
groupdocs-viewer drawing.dwg -t png -p 9000 --no-open
python -m groupdocs.viewer contracts -l GroupDocs.Viewer.lic
```

| Option | Default | |
|---|---|---|
| `path` | current folder | A file or a folder. Given a file, only that file is served. |
| `-p`, `--port` | 8080 | When 8080 is busy, a free port is used. `0` asks for any free port. |
| `-b`, `--bind` | `127.0.0.1` | Only this machine can connect. Any other address lets other machines connect, and only the session token keeps them out. |
| `--allow-host` | | Another name the browser may use for the server, such as a DNS name of this machine (repeatable). |
| `--no-open` | | Do not open the browser. |
| `-l`, `--license-path` | `GROUPDOCS_LIC_PATH` | Licence file or URL. A licence that cannot be applied stops the command at startup. |
| `-t`, `--viewer-type` | `html` | Render pages as `html`, `png` or `jpg`. |
| `--cache-dir` | per-user cache folder | Rendered pages are kept here and rendered again when a file changes. |
| `-v`, `--verbose` | | Log every request, and the full error of a failed one. |

Files cannot be uploaded. Hidden files (and on Windows, files and folders with the hidden or system attribute) and links that lead out of the folder are not served. Press Ctrl+C to stop. To put the viewer inside your own FastAPI, Flask or Django application, with cloud storage, a shared cache or authentication, use [groupdocs-viewer-net-ui](https://pypi.org/project/groupdocs-viewer-net-ui/).

## 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:
  ```json
  { "mcpServers": { "groupdocs-docs": { "url": "https://docs.groupdocs.com/mcp" } } }
  ```
- **GroupDocs.Viewer MCP server** -- let an agent see document pages: it renders any page as a PNG image on your machine, with nothing uploaded: [docs.groupdocs.com/viewer/mcp](https://docs.groupdocs.com/viewer/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:
- An evaluation notice is added to every rendered page.
- Only the first two pages of a document are rendered, and `get_view_info` reports at most two.

To remove these limitations, apply a license or request a [temporary license](https://purchase.groupdocs.com/temporary-license):

```python
from groupdocs.viewer import License
License().set_license("path/to/license.lic")
```

Or set the environment variable, which is applied at the first Viewer call:
```bash
export GROUPDOCS_LIC_PATH="path/to/license.lic"
```

If that licence cannot be applied (an expired subscription, a licence for another product, a
missing file), every Viewer call raises `LicenseError` with the reason until a licence is
applied. Set `GROUPDOCS_LIC_STRICT=0` to run in evaluation mode with a `LicenseWarning` instead.

## Troubleshooting

| Issue | Platform | Fix |
|---|---|---|
| `Failed to detect file type` for PSD, PSB, AI or ONE | Linux/macOS | These formats are Windows-only — render them on Windows |
| `Cannot find fallback font 'Generic Sans Serif'` rendering MPP/MPT/MPX | Linux | Install the Microsoft core fonts: `apt-get install ttf-mscorefonts-installer && fc-cache -f` (Debian: enable `contrib`). Liberation fonts do not satisfy this lookup |
| Garbled text or missing fonts in rendered HTML/PDF | Linux | `apt-get install ttf-mscorefonts-installer fontconfig && fc-cache -f` |
| `DllNotFoundException: libgdiplus` or `The type initializer for 'Gdip' threw an exception` | Linux/macOS | Not expected: since 26.9 no libgdiplus is needed. Install it (`apt-get install libgdiplus` / `brew install mono-libgdiplus`) and report the document to support |
| The process exits with code 134 and `Couldn't find a valid ICU package`, with no Python exception | Linux | Install ICU (`apt-get install libicu-dev`). Do NOT set `DOTNET_SYSTEM_GLOBALIZATION_INVARIANT` instead |
| Page images (PNG, JPG) of a spreadsheet lose the spaces between words and clip digits at cell edges | Linux | A known issue of engine 26.10: render spreadsheets to PDF or HTML on Linux |
| A workbook rendered twice with the same `Viewer` has more pages the second time | All | A known engine issue: create a new `Viewer` for each render |
| The process dies while rendering a presentation whose fonts are not installed | Linux | Happens when Debian's `fonts-noto-extra` is installed: set `default_font_name` on the view options to an installed font, or remove `fonts-noto-extra` |
| `DllNotFoundException: libSkiaSharp` after upgrading | macOS | An older system copy is shadowing the bundled one: `sudo mv /usr/local/lib/libSkiaSharp.dylib /usr/local/lib/libSkiaSharp.dylib.bak` |
| `RuntimeError: The .NET runtime cannot be used in a process forked after it started` (up to 26.9.0: the parent process died with a segmentation fault) | Linux/macOS | A worker was forked after the parent's first GroupDocs call: `multiprocessing` with the `fork` start method, `gunicorn --preload`, Celery prefork. Use `multiprocessing.get_context("spawn")`, start the workers before the first call, or drop `--preload`. `uvicorn --workers` is safe |
| `is not a supported wheel on this platform`, `No matching distribution found for groupdocs-viewer-net`, or pip installs a version older than 26.9 | Linux/macOS | The OS is older than the wheel needs (glibc 2.27, macOS 12), or pip is older than 20.3: `python -m pip install --upgrade pip`. Versions up to 26.5 were tagged for older systems, so an unpinned install falls back to them — and they fail at first use there. On an Intel Mac, a Python built against an old SDK reports macOS 10.16 — use pip 24.1+ or `SYSTEM_VERSION_COMPAT=0 pip install groupdocs-viewer-net` |

**`libgdiplus` is not required.** The Linux and macOS wheels render through SkiaSharp and Aspose.Drawing and never call `libgdiplus`: every format family renders the same with and without it in a Linux container. You can drop `libgdiplus` / `mono-libgdiplus` from your images and provisioning scripts.

## System Requirements

- Python 3.5 - 3.14, pip 20.3 or newer
- Windows x64, Linux x64, macOS x64/ARM64 — 64-bit Python only; there is no 32-bit Windows wheel
- Linux: glibc 2.27 or newer (e.g. Ubuntu 18.04+, Debian 10+, RHEL 8+), plus fonts and ICU (`apt-get install libicu-dev fontconfig ttf-mscorefonts-installer`; on Debian enable `contrib` first). No `libgdiplus`.
- macOS 12 or newer, Intel or Apple Silicon.

## Upgrading from 26.9

- **A misspelled option raises.** Assigning an attribute that a class does not have raises `AttributeError` with a "Did you mean" hint. 26.9 stored it on the Python object and the engine never saw it: `options.cad_options.pc_3_file = "plot.pc3"` did nothing; the property is `pc3_file`.
- **A licence that cannot be applied raises `LicenseError`** at the first Viewer call, where 26.9 rendered in evaluation mode without a word. `GROUPDOCS_LIC_STRICT=0` brings evaluation mode back, with a `LicenseWarning`.
- **pip also installs `groupdocs-shared-net`**, the package of `groupdocs.pydrawing` and `groupdocs.pycore` that every GroupDocs Python package shares. An offline install needs both wheels in one folder. `from groupdocs.viewer import Color` is unchanged.
- **A file object passed to `Viewer` stays open** after the call; 26.9 closed it, and emptied one opened with `"r+b"`.
- **`view()` takes .NET's argument order** when it gets a cancellation token: options, token, page numbers, or keywords (`viewer.view(options, cancellation_token=token, page_numbers=[1, 2])`).
- **The engine** is GroupDocs.Viewer for .NET 26.10 on its .NET 10 build (`GroupDocs.Viewer.Net100.Windows` on Windows, `GroupDocs.Viewer.Net100` on Linux and macOS), with the .NET runtime 10.0.15.

## More Resources

- [Documentation](https://docs.groupdocs.com/viewer/python-net/)
- [Code Examples](https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET)
- [Free Support Forum](https://forum.groupdocs.com/c/viewer)
- [Temporary License](https://purchase.groupdocs.com/temporary-license)

Also available for other platforms:
[.NET](https://products.groupdocs.com/viewer/net/) | [Java](https://products.groupdocs.com/viewer/java/) | [Node.js](https://products.groupdocs.com/viewer/nodejs-java/)

---

[Product Page](https://products.groupdocs.com/viewer/python-net/) | [Docs](https://docs.groupdocs.com/viewer/python-net/) | [Demos](https://products.groupdocs.app/viewer/family) | [API Reference](https://reference.groupdocs.com/viewer/) | [Blog](https://blog.groupdocs.com/category/viewer/) | [Free Support](https://forum.groupdocs.com/c/viewer) | [Temporary License](https://purchase.groupdocs.com/temporary-license)
