# Quick Start Guide Set up a virtual environment, install groupdocs-viewer-net, and run three minimal examples — DOCX → HTML, DOCX → PDF, and DOCX → per-page PNG — in under five minutes. This guide provides a quick overview of how to set up and start using GroupDocs.Viewer for Python via .NET. This library enables developers to render documents to HTML, PDF, PNG, and JPG formats with minimal configuration. ## Prerequisites To proceed, make sure you have: 1. **Configured** environment as described in the [System Requirements]({{< ref "/viewer/python-net/getting-started/system-requirements.md" >}}) topic. 2. **Optionally** you may [Get a Temporary License](https://purchase.groupdocs.com/temporary-license/) to test all the product features. ## Set Up Your Development Environment For best practices, use a virtual environment to manage dependencies in Python applications. Learn more about virtual environment at [Create and Use Virtual Environments](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#create-and-use-virtual-environments) documentation topic. ### Create and Activate a Virtual Environment Create a virtual environment: {{< tabs "example1">}} {{< tab "Windows" >}} ```ps py -m venv .venv ``` {{< /tab >}} {{< tab "Linux" >}} ```bash python3 -m venv .venv ``` {{< /tab >}} {{< tab "macOS" >}} ```bash python3 -m venv .venv ``` {{< /tab >}} {{< /tabs >}} Activate a virtual environment: {{< tabs "example2">}} {{< tab "Windows" >}} ```ps .venv\Scripts\activate ``` {{< /tab >}} {{< tab "Linux" >}} ```bash source .venv/bin/activate ``` {{< /tab >}} {{< tab "macOS" >}} ```bash source .venv/bin/activate ``` {{< /tab >}} {{< /tabs >}} ### Install `groupdocs-viewer-net` Package After activating the virtual environment, run the following command in your terminal to install the latest version of the package: {{< tabs "example3">}} {{< tab "Windows" >}} ```ps py -m pip install groupdocs-viewer-net ``` {{< /tab >}} {{< tab "Linux" >}} ```bash python3 -m pip install groupdocs-viewer-net ``` {{< /tab >}} {{< tab "macOS" >}} ```bash python3 -m pip install groupdocs-viewer-net ``` {{< /tab >}} {{< /tabs >}} Ensure the package is installed successfully. You should see the message ```bash Successfully installed groupdocs-viewer-net-* ``` ## Example 1: Render document to HTML To quickly test the library, let's render a DOCX file to HTML. You can also download the app that we're going to build [here](https://docs.groupdocs.com/viewer/python-net/_sample_files/getting-started/quick-start-guide/render_docx_to_html.zip). {{< tabs "demo_app_render_docx_to_html">}} {{< tab "render_docx_to_html.py" >}} ```python import os from groupdocs.viewer import License, Viewer from groupdocs.viewer.options import HtmlViewOptions def render_docx_to_html(): # Get license file absolute path license_path = os.path.abspath("./GroupDocs.Viewer.lic") if os.path.exists(license_path): # Create License and set the path license = License() license.set_license(license_path) # Load DOCX file with Viewer("./sample.docx") as viewer: # Create view options html_options = HtmlViewOptions.for_embedded_resources("render_docx_to_html/page_{0}.html") # Render DOCX to HTML viewer.view(html_options) if __name__ == "__main__": render_docx_to_html() ``` {{< /tab >}} {{< tab "sample.docx" >}} {{< tab-text >}} `sample.docx` is the sample file used in this example. Click [here](https://docs.groupdocs.com/viewer/python-net/_sample_files/getting-started/quick-start-guide/sample.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "render-docx-to-html-outputs.zip" >}} ```text render_docx_to_html/page_1.html (253 KB) render_docx_to_html/page_2.html (110 KB) render_docx_to_html/page_3.html (148 KB) render_docx_to_html/page_4.html (1001 KB) render_docx_to_html/page_5.html (86 KB) ``` [Download full output](https://docs.groupdocs.com/viewer/python-net/_output_files/getting-started/quick-start-guide/render_docx_to_html/render-docx-to-html-outputs.zip) {{< /tab >}} {{< /tabs >}} Your folder tree should look similar to the following directory structure: ```Directory 📂 demo-app ├──render_docx_to_html.py ├──sample.docx └──GroupDocs.Viewer.lic (Optionally) ``` ### Run the App {{< tabs "run-the-app">}} {{< tab "Windows" >}} ```ps py render_docx_to_html.py ``` {{< /tab >}} {{< tab "Linux" >}} ```bash python3 render_docx_to_html.py ``` {{< /tab >}} {{< tab "macOS" >}} ```bash python3 render_docx_to_html.py ``` {{< /tab >}} {{< /tabs >}} After running the app you can deactivate virtual environment by executing `deactivate` or closing your shell. ### Explanation - `Viewer("./sample.docx")`: Initializes the viewer with the DOCX file. - `HtmlViewOptions.for_embedded_resources("render_docx_to_html/page_{0}.html")`: Specifies the output format as HTML with embedded resources. - `viewer.view(html_options)`: Renders the DOCX file to HTML and saves it as `page_1.html`, `page_2.html`, etc. ## Example 2: Render document to PDF In this example we'll render a DOCX file to PDF. You can download the app that we're going to build [here](https://docs.groupdocs.com/viewer/python-net/_sample_files/getting-started/quick-start-guide/render_docx_to_pdf.zip). {{< tabs "demo_app_render_docx_to_pdf">}} {{< tab "render_docx_to_pdf.py" >}} ```python import os from groupdocs.viewer import License, Viewer from groupdocs.viewer.options import PdfViewOptions def render_docx_to_pdf(): # Get license file absolute path license_path = os.path.abspath("./GroupDocs.Viewer.lic") if os.path.exists(license_path): # Create License and set the path license = License() license.set_license(license_path) # Load DOCX file with Viewer("./sample.docx") as viewer: # Create view options pdf_options = PdfViewOptions("render_docx_to_pdf/output.pdf") # Render DOCX to PDF viewer.view(pdf_options) if __name__ == "__main__": render_docx_to_pdf() ``` {{< /tab >}} {{< tab "sample.docx" >}} {{< tab-text >}} `sample.docx` is the sample file used in this example. Click [here](https://docs.groupdocs.com/viewer/python-net/_sample_files/getting-started/quick-start-guide/sample.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "output.pdf" >}} ```text Binary file (PDF, 719 KB) ``` [Download full output](https://docs.groupdocs.com/viewer/python-net/_output_files/getting-started/quick-start-guide/render_docx_to_pdf/output.pdf) {{< /tab >}} {{< /tabs >}} Your folder tree should look similar to the following directory structure: ```Directory 📂 demo-app ├──sample.docx ├──render_docx_to_pdf.py └──GroupDocs.Viewer.lic (Optionally) ``` ### Run the App {{< tabs "run_the_app_render_docx_to_pdf">}} {{< tab "Windows" >}} ```ps py render_docx_to_pdf.py ``` {{< /tab >}} {{< tab "Linux" >}} ```bash python3 render_docx_to_pdf.py ``` {{< /tab >}} {{< tab "macOS" >}} ```bash python3 render_docx_to_pdf.py ``` {{< /tab >}} {{< /tabs >}} After running the app you can deactivate virtual environment by executing `deactivate` or closing your shell. ### Explanation - `Viewer("./sample.docx")`: Initializes the viewer with the DOCX file. - `PdfViewOptions("output.pdf")`: Specifies the output format as PDF. - `viewer.view(pdf_options)`: Renders the DOCX file to PDF and saves it as `output.pdf`. ## Example 3: Render document to PNG images In this example we'll render a DOCX file to PNG images. You can download the app that we're going to build [here](https://docs.groupdocs.com/viewer/python-net/_sample_files/getting-started/quick-start-guide/render_docx_to_png.zip). {{< tabs "demo_app_render_docx_to_png">}} {{< tab "render_docx_to_png.py" >}} ```python import os from groupdocs.viewer import License, Viewer from groupdocs.viewer.options import PngViewOptions def render_docx_to_png(): # Get license file absolute path license_path = os.path.abspath("./GroupDocs.Viewer.lic") if os.path.exists(license_path): # Create License and set the path license = License() license.set_license(license_path) # Load DOCX file with Viewer("./sample.docx") as viewer: # Create view options png_options = PngViewOptions("render_docx_to_png/output_{0}.png") # Render DOCX to PNG images viewer.view(png_options) if __name__ == "__main__": render_docx_to_png() ``` {{< /tab >}} {{< tab "sample.docx" >}} {{< tab-text >}} `sample.docx` is the sample file used in this example. Click [here](https://docs.groupdocs.com/viewer/python-net/_sample_files/getting-started/quick-start-guide/sample.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "render-docx-to-png-outputs.zip" >}} ```text render_docx_to_png/output_1.png (287 KB) render_docx_to_png/output_2.png (33 KB) render_docx_to_png/output_3.png (33 KB) render_docx_to_png/output_4.png (430 KB) render_docx_to_png/output_5.png (21 KB) ``` [Download full output](https://docs.groupdocs.com/viewer/python-net/_output_files/getting-started/quick-start-guide/render_docx_to_png/render-docx-to-png-outputs.zip) {{< /tab >}} {{< /tabs >}} Your folder tree should look similar to the following directory structure: ```Directory 📂 demo-app ├──sample.docx ├──render_docx_to_png.py └──GroupDocs.Viewer.lic (Optionally) ``` ### Run the App {{< tabs "run_the_app_render_docx_to_png">}} {{< tab "Windows" >}} ```ps py render_docx_to_png.py ``` {{< /tab >}} {{< tab "Linux" >}} ```bash python3 render_docx_to_png.py ``` {{< /tab >}} {{< tab "macOS" >}} ```bash python3 render_docx_to_png.py ``` {{< /tab >}} {{< /tabs >}} After running the app you can deactivate virtual environment by executing `deactivate` or closing your shell. ### Explanation - `Viewer("./sample.docx")`: Initializes the viewer with the DOCX file. - `PngViewOptions("render_docx_to_png/output_{0}.png")`: Specifies the output format as PNG images. - `viewer.view(png_options)`: Renders each page of the DOCX file to PNG and saves them as `output_1.png`, `output_2.png`, etc. ## Next Steps After completing the basics, explore additional resources to enhance your usage: - [Supported File Formats]({{< ref "/viewer/python-net/getting-started/supported-document-formats.md" >}}): Review the full list of supported file types. - [Licensing]({{< ref "/viewer/python-net/getting-started/licensing-and-subscription.md" >}}): Check details on licensing and evaluation. - [Technical Support]({{< ref "viewer/python-net/technical-support" >}}): Contact support for assistance if you encounter issues.