Web UI for groupdocs-viewer-net — mount into FastAPI/Flask/Django, or run standalone.
Project description
UI for GroupDocs.Viewer for Python via .NET
A web UI for groupdocs-viewer-net — view 170+ document and image formats in a browser. Mount inside an existing FastAPI / Flask / Django app, or run standalone via the bundled CLI.
The frontend is the same battle-tested Angular SPA from the GroupDocs.Viewer for .NET UI project, vendored into this package — one pip install and you're done.
Install
pip install groupdocs-viewer-net-ui
Optional cloud-storage / cache backends:
pip install "groupdocs-viewer-net-ui[s3]" # S3FileStorage
pip install "groupdocs-viewer-net-ui[azure]" # AzureBlobFileStorage
pip install "groupdocs-viewer-net-ui[redis]" # RedisCache
pip install "groupdocs-viewer-net-ui[all]"
Run it
CLI (zero config)
groupdocs-viewer-ui serve --files ./documents --cache ./.viewer-cache
# → http://127.0.0.1:8080/viewer/
Docker
docker compose up
# Drop documents into ./documents on the host
In code
from groupdocs_viewer_ui import Config, create_app
from groupdocs_viewer_ui.cache.local import LocalFileCache
from groupdocs_viewer_ui.storage.local import LocalFileStorage
from groupdocs_viewer_ui.viewer.selfhost import SelfHostViewer
storage = LocalFileStorage("./Files")
app = create_app(
Config(),
storage=storage,
cache=LocalFileCache("./Cache"),
viewer=SelfHostViewer(storage=storage),
)
# Run with: uvicorn myapp:app
create_app() returns a Starlette ASGI app — mount it under FastAPI directly, or bridge to Flask/Django with a2wsgi. See examples/ for runnable patterns.
Configure
Config() accepts knobs for rendering mode, preload count, initial zoom, UI toggles (header, toolbar, thumbnails, search, print, etc.), localization, branding, and routing. See AGENTS.md for the full field reference.
Config(
rendering_mode="html", # or "image"
preload_pages=3,
initial_zoom="Fit Page", # or "Fit Width", "Fit Height", "100%", "75%", etc.
enable_thumbnails=True,
ui_title="My Document Viewer",
custom_css="<style>:root { --c-bg-brand: #0d9488; }</style>",
)
Storage backends
Built-in: LocalFileStorage, S3FileStorage ([s3] extra), AzureBlobFileStorage ([azure] extra). Implement the FileStorage protocol for anything else — three async methods. See examples/05_custom_storage/ for a SQLite-backed example.
Cache backends
Built-in: InMemoryCache, LocalFileCache, RedisCache ([redis] extra). When you supply both viewer and cache to create_app(), the viewer is auto-wrapped in a CachingViewer decorator — no manual composition required. Implement the FileCache protocol for custom backends. See examples/06_custom_cache/ for a TTL wrapper.
Authentication
from starlette.exceptions import HTTPException
async def require_session(request):
if request.cookies.get("session") not in VALID_SESSIONS:
raise HTTPException(status_code=401, detail="Login required")
app = create_app(..., auth_check=require_session)
The check runs before every /viewer-api/* request. /health, the SPA, and static assets are deliberately not guarded — wrap the whole app yourself if you need broader scope. See examples/07_auth/ for session-cookie + bearer-token patterns.
For rate limiting, pair with slowapi or asgi-ratelimit as standard Starlette middleware.
Examples
| Path | Shows |
|---|---|
examples/01_cli_quickstart/ |
Zero-config CLI demo |
examples/02_fastapi_basic/ |
Mount in FastAPI |
examples/03_flask_basic/ |
Mount in Flask via a2wsgi |
examples/04_custom_branding/ |
Custom logo + CSS |
examples/05_custom_storage/ |
SQLite FileStorage |
examples/06_custom_cache/ |
TTL FileCache decorator |
examples/07_auth/ |
Session cookie + bearer token auth |
Linux
groupdocs-viewer-net needs libgdiplus, libfontconfig1, fonts-liberation, and fonts-dejavu for rendering. The bundled Dockerfile installs them; for bare metal:
sudo apt-get install -y libgdiplus libfontconfig1 fontconfig fonts-liberation fonts-dejavu
Documentation
AGENTS.md— full reference: config fields, protocols, extensibility, gotchasexamples/— runnable end-to-end demos for each integration pattern- GroupDocs.Viewer for Python via .NET docs
Development
pip install -e ".[dev]"
pytest # 107 passing (~21s; 5 e2e tests render a real DOCX)
ruff check src tests
mypy src
License
MIT — see LICENSE.
Support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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_ui-26.4.0.post1.tar.gz.
File metadata
- Download URL: groupdocs_viewer_net_ui-26.4.0.post1.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e314def84728c96b0294560e484ad407174847fefd11886bc5eb3dd19f24a460
|
|
| MD5 |
cb75e5b77407229edddebc0d042776fa
|
|
| BLAKE2b-256 |
80a4d0b5d531ed4d12d1cdb65929caa5fa6af8697fe66df66ed09b37560da2d4
|
File details
Details for the file groupdocs_viewer_net_ui-26.4.0.post1-py3-none-any.whl.
File metadata
- Download URL: groupdocs_viewer_net_ui-26.4.0.post1-py3-none-any.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e7eaa7bc492c2048a4bd386341d6b509f4b90719f4f951abe4a1908ae9d63b1
|
|
| MD5 |
851be39b16ba119454dbc10491d747e5
|
|
| BLAKE2b-256 |
3fc2f37cf78675476177d965b7da4b975b538e7a55880f82fabb4596cc05acda
|