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, 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, downloaded or cloned from GitHub:
https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET
The examples repository closely follows the structure of this documentation, making it easy to locate specific examples and related input files.
📂 GroupDocs.Viewer-for-Python-via-.NET
├── Demos
│ ├── hello-world-docker
│ │ ├── output
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── render_docx_to_html.py
│ │ ├── requirements.txt
│ │ └── sample.docx
│ └── hello-world-macos
│ ├── output
│ ├── README.md
│ ├── render_docx_to_html.py
│ ├── requirements.txt
│ └── sample.docx
├── Examples
│ ├── getting-started
│ │ └── hello-world
│ │ ├── render_docx_to_html.py
│ │ ├── render_docx_to_pdf.py
│ │ ├── render_docx_to_png.py
│ │ └── sample.docx
│ ├── licensing
│ │ ├── set_license_from_file.py
│ │ ├── set_license_from_stream.py
│ │ └── set_metered_license.py
│ ├── requirements.txt
│ └── run_all_examples.py
├── LICENSE
Navigate to the Examples directory and create a virtual environment.
Create a virtual environment:
python3 -m venv .venv
python3 -m venv .venv
py -m venv .venv
Activate the virtual environment:
source .venv/bin/activate
source .venv/bin/activate
.venv\Scripts\activate
After activating the virtual environment, install the required dependencies:
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements.txt
py -m pip install -r requirements.txt
If you have a license file, you can configure it in the run_all_examples.py file.
By default, GroupDocs.Viewer for Python via .NET searches for:
- The
GROUPDOCS_LIC_PATHenvironment variable, or - A file with the
.licextension located in the project root directory.
NoteFor more details about licensing, evaluation limitations, and obtaining a temporary license, see the Licensing documentation.
To execute all available examples, run the run_all_examples.py script:
python3 run_all_examples.py
python3 run_all_examples.py
py 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 using 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 documented 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.