How to Run Examples

The complete project GroupDocs.Parser for Python via .NET with code examples and sample files is hosted on GitHub. Every example of this documentation is there as a script, next to its input files.

Prerequisites

  • Python 3.6-3.14, 64-bit. The package itself supports Python 3.5, but the examples use f-strings, which need 3.6.
  • On Linux, ICU, fontconfig, the Liberation fonts and libgdiplus (libicu-dev libfontconfig1 fonts-liberation libgdiplus). On macOS: mono-libgdiplus (via Homebrew). See System Requirements for what each one is needed for.

Get the code

git clone https://github.com/groupdocs-parser/GroupDocs.Parser-for-Python-via-.NET.git
cd ./GroupDocs.Parser-for-Python-via-.NET/Examples

Project structure

Examples/
├── run_all_examples.py     # Runs every example and prints a pass/fail summary
├── _run_example.py         # Per-example wrapper (applies the license, reports evaluation-limit errors)
├── requirements.txt
├── product-overview/       # The quick examples of the product overview
├── licensing/              # Set a license from a file, a stream, or a metered key
├── getting-started/
│   ├── hello-world/        # Extract the text of a document
│   └── quick-start-guide/  # Extract text, metadata and tables
└── developer-guide/
    ├── basic-usage/        # Text, images, metadata, document info, templates, containers
    └── advanced-usage/     # Loading, extraction modes, tables, images, hyperlinks, annotations, logging

The folders follow this documentation: each page’s examples are in the folder of that page, with the files they read.

Set up

pip install -r requirements.txt

requirements.txt pins groupdocs-parser-net==26.10.0, which pip installs from PyPI with the wheel for your platform.

To run the examples with the full feature set, apply a license. The simplest way is the GROUPDOCS_LIC_PATH environment variable, which run_all_examples.py reads and the package applies at the first call into the engine:

set GROUPDOCS_LIC_PATH=C:\path\to\GroupDocs.Parser.lic
export GROUPDOCS_LIC_PATH=/path/to/GroupDocs.Parser.lic

Without a license the suite still runs, in evaluation mode: extracted text stops after about 20 lines and ends with an evaluation notice, and only the first 5 metadata items are returned (see Licensing and evaluation). Each example runs in its own subprocess.

Run the examples

Run the full suite, which prints a pass/fail summary at the end:

python run_all_examples.py

You can also run any single example by navigating to its folder and running the script directly. Each example uses paths relative to its own folder, and writes its results next to the script:

cd getting-started/hello-world
python hello_world.py

Run with Docker

The repository ships a Dockerfile that builds a Linux image with Python 3.13, the system packages the library needs on Linux (ICU, fontconfig, the Liberation fonts and libgdiplus), and the package preinstalled. The image installs the package from PyPI.

# Build the image
docker build -t parser-examples .

# Run unlicensed (evaluation mode)
docker run --rm parser-examples

# Run with a license mounted from the host
docker run --rm \
    -v /path/to/license:/lic:ro \
    -e GROUPDOCS_LIC_PATH=/lic/your-license.lic \
    parser-examples

Continuous integration

The .github/workflows/ directory contains a workflow that runs the full example suite on ubuntu-latest with Python 3.13. It runs on every push, and on demand (Actions > Run Examples > Run workflow). The same run is reproducible locally via the Dockerfile above.

Troubleshooting

  • “Couldn’t find a valid ICU package”, with the Python process ending abruptly (Linux) - install ICU (libicu-dev on Debian and Ubuntu). Do not set DOTNET_SYSTEM_GLOBALIZATION_INVARIANT.
  • “The type initializer for ‘Gdip’ threw an exception” or DllNotFoundException: libgdiplus (Linux/macOS) - install libgdiplus (sudo apt install libgdiplus, or brew install mono-libgdiplus on macOS). Presentations need it: page previews, ODP and OTP files, and PowerPoint files with tables or hyperlinks.
  • The merged cells of a Word table come out at the wrong row in a get_structure() example (Linux) - install the Liberation fonts (sudo apt install fonts-liberation).
  • An OCR example raises GroupDocsParserException naming Microsoft.ML.OnnxRuntime.NativeMethods (macOS 13.0-13.2) - OCR needs macOS 13.3 or newer.
  • An aspose_data folder of about 80 MB appears next to an OCR example - the first OCR call unpacks its recognition models there, with no download. Choose another folder with Resources.storage_path before the first OCR call.
  • LicenseError at the first call - GROUPDOCS_LIC_PATH names a file that is missing, expired or for another product. The message gives the reason.
  • The first example takes 20-30 seconds - that is the engine loading, once per process.
  • Evaluation marks in the output - “Evaluation only. Created with GroupDocs.Parser for .NET.” after about 20 lines of text, or an extra metadata item. Apply a license (see above); a free 30-day temporary license is available.

Contribute

If you would like to add or improve an example, we encourage you to contribute to the project. All examples in this repository are open source and can be freely used in your own applications. Fork the repository, edit the source code, and open a pull request.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.