How to Run Examples
Leave feedback
On this page
This page explains how to set up and run the code examples for GroupDocs.Viewer for Python via .NET. The examples demonstrate common usage scenarios such as rendering documents to HTML, PDF, PNG, and JPEG, working with documents inside archives, extracting attachments, and retrieving document information.
Before running the examples, ensure that you have:
- A configured environment that meets the requirements described in the System Requirements topic.
- The examples repository, cloned or downloaded from GitHub:
https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET
The examples repository mirrors the structure of this documentation — every page in the Developer Guide and Rendering Basics sections has a matching folder under Examples/:
📂 GroupDocs.Viewer-for-Python-via-.NET
├── Demos
│ ├── hello-world-docker
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── render_docx_to_html.py
│ │ ├── requirements.txt
│ │ └── sample.docx
│ └── hello-world-macos
│ ├── README.md
│ ├── render_docx_to_html.py
│ ├── requirements.txt
│ └── sample.docx
├── Examples
│ ├── getting-started
│ │ └── quick-start-guide
│ │ ├── render_docx_to_html.py
│ │ ├── render_docx_to_pdf.py
│ │ ├── render_docx_to_png.py
│ │ └── sample.docx
│ ├── developer-guide
│ │ ├── get-document-info
│ │ ├── loading-documents
│ │ ├── logging-and-diagnostics
│ │ ├── processing-attachments
│ │ └── rendering-documents
│ ├── rendering-basics
│ │ ├── render-archive-files
│ │ ├── render-cad-documents
│ │ ├── render-email-messages
│ │ ├── render-images
│ │ ├── render-pdf-documents
│ │ ├── render-presentations
│ │ ├── render-spreadsheets
│ │ ├── render-text-files
│ │ ├── render-visio-documents
│ │ ├── render-web-documents
│ │ └── render-word-documents
│ ├── licensing
│ │ ├── set_license_from_file.py
│ │ ├── set_license_from_stream.py
│ │ └── set_metered_license.py
│ ├── requirements.txt
│ └── run_all_examples.py
├── Dockerfile
├── LICENSE
└── README.md
Navigate to the Examples directory and create a virtual environment.
Create a virtual environment:
py -m venv .venv
python3 -m venv .venv
python3 -m venv .venv
Activate the virtual environment:
.venv\Scripts\activate
source .venv/bin/activate
source .venv/bin/activate
After activating the virtual environment, install the required dependencies:
py -m pip install -r requirements.txt
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements.txt
If you have a license file, you can configure it in the run_all_examples.py script. By default, GroupDocs.Viewer for Python via .NET searches for:
- The
GROUPDOCS_LIC_PATHenvironment variable, then - Any file with the
.licextension in the current working directory.
NoteFor more details about licensing, evaluation limitations, and obtaining a temporary license, see the Licensing and Subscription page.
To execute all available examples, run the run_all_examples.py script:
py run_all_examples.py
python3 run_all_examples.py
python3 run_all_examples.py
This script runs each example sequentially and demonstrates:
- Rendering documents to HTML, PDF, PNG, and JPEG.
- Processing documents stored in archives.
- Retrieving document information.
- Applying various rendering options.
To run a single example, navigate to the directory containing the desired script and execute it directly with Python.
Most examples generate one or more output files. These files are typically saved in the same directory as the example script.
If you experience issues while running the examples:
- Verify that all dependencies are installed correctly.
- Ensure your environment meets the System Requirements.
- Visit the Technical Support page for additional help.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.