GroupDocs.Viewer for Python via .NET 26.11 Release Notes
This release upgrades the GroupDocs.Viewer engine from 26.8 to 26.10 and moves it to the engine’s .NET 10 build, and it brings every fix made to the Python layer since 26.9. A new groupdocs-viewer command opens a document or a folder in the browser, with the GroupDocs.Viewer web UI and no web framework. Rendering to memory with a Python function works, a running render can be cancelled, and a licence that cannot be applied raises LicenseError instead of quietly rendering in evaluation mode. Memory no longer grows with each call that passes a stream, a forked process no longer crashes its parent, and file objects passed in stay open and unchanged. The embedded .NET runtime moves from 10.0.12 to 10.0.15.
Three changes can affect existing code. Assigning an option that a class does not have now raises AttributeError; it used to be dropped silently, so code with a misspelled option (pc_3_file for pc3_file) did nothing. A licence in GROUPDOCS_LIC_PATH that cannot be applied now raises LicenseError at the first call; GROUPDOCS_LIC_STRICT=0 brings back evaluation mode, with a warning. pip now also installs groupdocs-shared-net, so an offline install needs both wheels. Nothing is removed or renamed.
Full List of Changes in This Release
| Key | Category | Summary |
|---|---|---|
| VIEWERPYTHON‑180 | Feature | Add CadOptions.enable_layered_rendering to show and hide CAD layers in HTML output without rendering again |
| VIEWERPYTHON‑181 | Feature | Add PdfOptions.fix_thai_marks to fix stranded Thai marks when rendering PDF to HTML |
| VIEWERPYTHON‑182 | Feature | Cancel a running render with CancellationTokenSource and view(options, cancellation_token=...) |
| VIEWERPYTHON‑199 | Feature | Add the groupdocs-viewer command to open a document or a folder in the browser |
| VIEWERPYTHON‑183 | Enhancement | Update the GroupDocs.Viewer engine from 26.8 to 26.10, on its .NET 10 build |
| VIEWERPYTHON‑184 | Enhancement | Raise LicenseError when the licence in GROUPDOCS_LIC_PATH cannot be applied, instead of running in evaluation mode silently |
| VIEWERPYTHON‑185 | Enhancement | Pass stream input and BytesIO output to .NET by pointer instead of base64 JSON |
| VIEWERPYTHON‑186 | Enhancement | Install the modules every GroupDocs Python package shares from the groupdocs-shared-net package |
| VIEWERPYTHON‑187 | Enhancement | Link docstrings to the Python documentation, and give each overload an example that calls it |
| VIEWERPYTHON‑165 | Fix | Components with known CVEs in 26.9.0: .NET runtime 10.0.12, System.Formats.Asn1 8.0.0, System.Security.Cryptography.Pkcs 8.0.0 and libpng 1.6.44 (ICU 59 in the engine’s Slides library remains) |
| VIEWERPYTHON‑170 | Fix | Python: assigning an option that does not exist is silently ignored |
| VIEWERPYTHON‑188 | Fix | A file object passed as input was closed by the call, and emptied when opened for update |
| VIEWERPYTHON‑189 | Fix | Memory grew with every call that passed a stream or a callback: their .NET objects were never released |
| VIEWERPYTHON‑190 | Fix | A process forked after the first Viewer call made the parent process crash with a segmentation fault |
| VIEWERPYTHON‑191 | Fix | Rendering to memory with a Python function failed: “cannot wrap function as CreatePageStream” |
| VIEWERPYTHON‑192 | Fix | Renders running in parallel threads could leave a BytesIO output empty or raise another thread’s exception |
| VIEWERPYTHON‑193 | Fix | On Windows, the package ran on a .NET installed on the machine, and failed beside another GroupDocs Python package |
| VIEWERPYTHON‑194 | Fix | On Linux, the engine’s font cache was written into the working directory |
| VIEWERPYTHON‑198 | Fix | On Python 3.10 and earlier, a SpooledTemporaryFile such as FastAPI’s UploadFile.file could not be passed to Viewer |
Major Features
Open 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 web UI in the browser, with page navigation, zoom, rotation, thumbnails, search, print, PDF download and a dark theme. The server uses the Python standard library only, so it adds no dependency and runs on Python 3.5 to 3.14:
groupdocs-viewer # browse the current folder
groupdocs-viewer ~/documents # browse a folder and its subfolders
groupdocs-viewer report.docx -t png # open one file, rendered as PNG pages
python -m groupdocs.viewer --version
It takes the options of the .NET tool GroupDocs.Viewer CLI — -p/--port (default 8080, or a free port when it is busy), -b/--bind, --no-open, -l/--license-path, -t/--viewer-type html|png|jpg — and --allow-host, --cache-dir and -v/--verbose. It is for the person at the machine: the address it prints and opens carries a session token, so other users of the machine and other websites cannot use it, and it listens on 127.0.0.1 unless told otherwise. Given a file, it serves that file only. Files cannot be uploaded, and a changed file is rendered again instead of being served from the cache. The UI is the build of GroupDocs.Viewer UI 26.10.0, on Angular 22. To embed the viewer in a FastAPI, Flask or Django application, use the groupdocs-viewer-net-ui package.
Cancel a running render
view(), get_view_info(), get_attachments() and save_attachment() take a cancellation_token, and CancellationTokenSource, CancellationToken and OperationCanceledError are importable from groupdocs.viewer. Up to 26.9 Python had no way to make a token. Cancel from another thread with source.cancel(), or after a number of seconds with cancel_after:
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:
print("cancelled")
The engine checks the token before rendering starts and, in a render of all pages to HTML, PNG or JPG, between pages. A render to PDF, and a render of an explicit page list, run to the end once rendering has started.
Render to memory with a Python function
Every documented way to render without writing files failed in 26.9: a function passed to PngViewOptions, JpgViewOptions, PdfViewOptions or HtmlViewOptions.for_embedded_resources / for_external_resources raised “cannot wrap function as CreatePageStream”. Functions and factory objects now work, and each BytesIO is filled by the time view() returns:
import io
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import PdfViewOptions, PngViewOptions
pages = {}
def create_page_stream(page_number):
pages[page_number] = io.BytesIO()
return pages[page_number]
pdf = io.BytesIO()
with Viewer("document.docx") as viewer:
viewer.view(PngViewOptions(create_page_stream))
viewer.view(PdfViewOptions(lambda: pdf))
print({number: len(page.getvalue()) for number, page in pages.items()}, len(pdf.getvalue()))
LicenseError instead of silent evaluation mode
A licence that failed to apply — an expired subscription, a licence for another product, a missing file — used to be ignored, and every render quietly came out in evaluation mode: two pages, with a notice on each. Now every Viewer call raises LicenseError until a licence is applied. The message names the variable, the source and the engine’s reason:
from groupdocs.viewer import LicenseError, Viewer
from groupdocs.viewer.options import PdfViewOptions
try:
with Viewer("document.docx") as viewer:
viewer.view(PdfViewOptions("output.pdf"))
except LicenseError as error:
print(error)
GROUPDOCS_LIC_STRICT=0 turns the failure into one LicenseWarning and evaluation mode. License().set_license(...) applied in code ends the refusal.
CAD layers in HTML output
With CadOptions.enable_layered_rendering set, a CAD drawing rendered to HTML groups each layer’s objects under an element whose id is the layer name, so a page can show and hide layers without rendering again:
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions
options = HtmlViewOptions.for_embedded_resources("page_{0}.html")
options.cad_options.enable_layered_rendering = True
with Viewer("drawing.dwg") as viewer:
viewer.view(options)
Thai text in PDF rendered to HTML
PdfOptions.fix_thai_marks fixes Thai marks that Safari and iOS browsers display stranded when a PDF is rendered to HTML with embedded resources. It can slow rendering down considerably, so it is off by default:
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions
options = HtmlViewOptions.for_embedded_resources("page_{0}.html")
options.pdf_options.fix_thai_marks = True
with Viewer("thai.pdf") as viewer:
viewer.view(options)
Engine 26.10 on its .NET 10 build
The package now wraps GroupDocs.Viewer for .NET 26.10 through its .NET 10 builds: GroupDocs.Viewer.Net100 on Linux and macOS, and GroupDocs.Viewer.Net100.Windows on Windows, which also renders Photoshop (PSD, PSB), Illustrator (AI) and OneNote files. It brings the engine fixes of 26.9 and 26.10, among them PDF to HTML text and graphics, PPTX on Linux, and CAD, TEX, EPS, IGS, PS, MSG and SVG documents on Linux. The embedded .NET runtime moves from 10.0.12 to 10.0.15.
One package for the shared modules
groupdocs.pydrawing (Color, Point, Size, Rectangle) and groupdocs.pycore used to be copied into every product wheel. With several GroupDocs packages in one environment the last install won, and uninstalling one product removed them for the others. They now come from groupdocs-shared-net 26.11.0, which pip installs with groupdocs-viewer-net. from groupdocs.viewer import Color is unchanged.
API Changes
Nothing is removed or renamed.
New types
groupdocs.viewer:CancellationTokenSourcemakes a token and cancels it (cancel(),cancel_after(seconds),token);CancellationTokenis whatcancellation_tokentakes;OperationCanceledErroris raised by a call whose token was cancelled.groupdocs.viewer:LicenseErroris raised by every Viewer call while a licence that could not be applied is pending;LicenseWarningis warned instead withGROUPDOCS_LIC_STRICT=0.groupdocs.viewer:GroupDocsViewerExceptionis the class of every engine error that has no more specific Python exception.
New members on existing classes
| Class | Member | Description |
|---|---|---|
Viewer | view(options, cancellation_token=None, page_numbers=None) | Also get_view_info, get_attachments and save_attachment take a cancellation_token |
CadOptions | enable_layered_rendering | Group each CAD layer under its own HTML element |
PdfOptions | fix_thai_marks | Fix stranded Thai marks in PDF to HTML |
Field | equals(), get_hash_code() | From the .NET type |
EmailOptions | equals() | From the .NET type |
IAuxDisposable | disposed | .NET event, subscribed with += |
view() takes its arguments in .NET’s order — options, token, page numbers — or as keywords: viewer.view(options, page_numbers=[1, 2]).
Fixed
- CVE findings in 26.9.0 (VIEWERPYTHON-165). The runtime moves from 10.0.12 to 10.0.15, System.Security.Cryptography.Pkcs from 8.0.0 to 9.0.21, System.Formats.Asn1 8.0.0 is no longer shipped (it is part of .NET 10), and the libpng in SkiaSharp moves from 1.6.44 to 1.6.58. ICU 59 inside the engine’s Slides native library is not fixed yet — see Known Issues.
- An option that does not exist is no longer dropped silently.
options.cad_options.pc_3_file = "x.pc3"now raisesAttributeError; the property ispc3_file. - A file object passed as input stays open and unchanged.
Viewer(f)closedf, and a file opened with"r+b"was truncated to 0 bytes. - Memory no longer grows with each call. A
BytesIOinput kept its whole document alive: 237 → 588 MB over 50 renders of a 7 MB workbook. The same 150 renders now stay between 245 and 316 MB. - A forked process no longer crashes its parent. On Linux and macOS, a child forked after the first Viewer call (
multiprocessingwithfork,gunicorn --preload, Celery prefork) made the parent die with a segmentation fault. The child now gets aRuntimeErrorat its first Viewer call; usemultiprocessing.get_context("spawn").uvicorn --workersis safe. - Rendering to memory with a Python function works — see Major Features.
- Parallel renders keep their own outputs. Under a thread pool, one request could flush another’s half-written
BytesIOor raise its exception. - On Windows the package runs on the .NET it embeds. On a machine with a newer .NET 10 installed, 26.9.0 ran on that one, and a second GroupDocs Python package in the same process failed with
hostfxr_get_runtime_delegate failed with 0x800080a3. - On Linux the font cache no longer lands in the working directory. In a container without
~/.local/share,Aspose/Drawing/SystemFontCache.xmlwas written into the current directory of every process. - A
SpooledTemporaryFileis accepted on Python 3.10 and earlier.Viewer(upload.file)with Starlette’s or FastAPI’s upload failed with “no overload matched”.
Known Issues
- On Linux, page images (PNG, JPG) of spreadsheets lose spaces and clip digits at cell edges: “FXP-3M PARTICIPATION” becomes “FXP-3MPARTICIPATION”. Render spreadsheets to PDF or HTML on Linux. (VIEWERPYTHON-195)
- Rendering a workbook twice with the same
Viewergives a longer document the second time (985 pages instead of 272). Create a newViewerfor each render. (VIEWERPYTHON-196) - On macOS,
get_view_info(ViewInfoOptions.for_png_view(extract_text=True))fails on a DOCX with “The number greater than zero is expected. (Parameter ‘width’)”. (VIEWERPYTHON-197) PdfOptimizationOptions.optimize_spreadsheetshas no effect when theVieweris created withViewerSettings, a logger for example. Create theViewerwithoutViewerSettingswhen you need the option. (VIEWERPYTHON-166)- On Linux, rendering a presentation whose fonts are not installed crashes the Python process when the fonts of Debian’s
fonts-noto-extrapackage are installed. Setdefault_font_nameon the view options to an installed font, or do not installfonts-noto-extra. (VIEWERPYTHON-167) - The engine’s Slides native library on Linux still contains ICU 59 and libpng 1.6.38, which CVE scanners report. A fix needs an engine release. (VIEWERPYTHON-165)
- A
SpooledTemporaryFilereturned by a page-stream function as an output stays empty on Python 3.11 and later, and is refused on earlier versions. Return anio.BytesIOor an open file instead.
Documentation
- The
README.mdon PyPI and theAGENTS.mdinside the package describe the .NET 10 builds, thegroupdocs-shared-netdependency and the offline install, rendering to memory, cancellation and its limits,LicenseError, and the evaluation limits: two pages, with a notice on each. - New pages: View documents in the browser, Save output to a stream, Cancel rendering, Threads, processes and web servers, Hello, World! and SDK, Cloud or MCP?.
- Updated pages: Installation (the shared package and the offline install), Licensing and Evaluation (two pages,
LicenseError), Troubleshooting (the known issues), CAD layers in HTML in Render CAD drawings, and Thai marks and OFD documents in Render PDF documents. - The supported formats list LHA/LZH and CAB archives and OFD documents, which the engine opened before but the list left out.
Requirements
- Python 3.5 – 3.14 (
python_requires = ">=3.5,<3.15") and pip 20.3 or newer - Linux x64 with glibc 2.27 or newer; macOS 12 or newer, Intel or Apple Silicon. On an Intel Mac, a Python built against a pre-11 macOS SDK reports the system as macOS 10.16 — use pip 24.1 or newer there, or
SYSTEM_VERSION_COMPAT=0 pip install groupdocs-viewer-net - Windows: no additional packages
- Linux: ICU, fontconfig and fonts —
apt-get install libicu-dev fontconfig ttf-mscorefonts-installer(on Debian, enable thecontribcomponent first). The Microsoft core fonts are required for MS Project files.libgdiplusis not needed. - macOS (Intel and Apple Silicon): no additional packages
groupdocs-shared-net26.11.0, which pip installs with the package- The .NET 10.0.15 runtime is embedded in the wheel; no separate install is needed
Wheel Distribution
| Platform | Wheel |
|---|---|
| Windows x64 | groupdocs_viewer_net-26.11.0-py3-none-win_amd64.whl |
| Linux x64 | groupdocs_viewer_net-26.11.0-py3-none-manylinux_2_27_x86_64.whl |
| macOS Intel | groupdocs_viewer_net-26.11.0-py3-none-macosx_12_0_x86_64.whl |
| macOS Apple Silicon | groupdocs_viewer_net-26.11.0-py3-none-macosx_12_0_arm64.whl |
| Any platform | groupdocs_shared_net-26.11.0-py3-none-any.whl |
pip install groupdocs-viewer-net==26.11.0
For an offline install, put the platform wheel and the groupdocs-shared-net wheel in one folder:
pip install --no-index --find-links <folder> groupdocs-viewer-net
Additional Resources
Feedback
Questions and issues are welcome on the GroupDocs.Viewer forum.