How to Run Examples

Every code example shown on this documentation site is also available in runnable form in the GroupDocs.Signature-for-Python-via-.NET repository on GitHub. Each example comes with its input sample files, so you can clone the repository and run any of them with a single command.

Prerequisites

Before running the examples, make sure you have:

  1. A supported platform and Python version. See System Requirements. Windows, Linux, and macOS (Intel and Apple Silicon) are supported. Linux and macOS need a few system packages. The examples need Python 3.6 or newer.
  2. Git, or download the repository as a ZIP from GitHub.
  3. A license file (optional but recommended). Without one, the library runs in evaluation mode: documents of more than two pages are refused, signed pages carry an evaluation line, and found signatures report masked values, so verification fails. See Licensing for how to obtain a free temporary license.

Get the Code

Clone the repository and navigate into it:

git clone https://github.com/groupdocs-signature/GroupDocs.Signature-for-Python-via-.NET.git
cd GroupDocs.Signature-for-Python-via-.NET

Project Structure

The repository mirrors this documentation tree. Every documentation page maps to a folder under Examples/, and every tabbed code example on a page maps to a .py file inside that folder. Input sample files live next to the script that reads them.

πŸ“‚ GroupDocs.Signature-for-Python-via-.NET
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ AGENTS.md                          ← extracted from the pip package for AI tools
β”œβ”€β”€ Dockerfile                         ← runs the whole suite on Linux
β”œβ”€β”€ .github/workflows/run-examples.yml ← CI: runs all examples on every push
└── Examples
    β”œβ”€β”€ requirements.txt
    β”œβ”€β”€ run_all_examples.py
    β”œβ”€β”€ getting-started
    β”‚   └── quick-start-guide
    β”‚       β”œβ”€β”€ sign_pdf_with_text_signature.py
    β”‚       β”œβ”€β”€ search_document_for_signatures.py
    β”‚       β”œβ”€β”€ verify_text_signature.py
    β”‚       β”œβ”€β”€ sample.pdf
    β”‚       └── signed.pdf
    β”œβ”€β”€ developer-guide
    β”‚   └── basic-usage
    β”‚       β”œβ”€β”€ electronic-signature-types/            (text, image, barcode, QR code, stamp, digital, form-field, metadata)
    β”‚       β”œβ”€β”€ search-for-electronic-signatures-in-document/
    β”‚       β”œβ”€β”€ verify-document-for-signatures/
    β”‚       β”œβ”€β”€ update-signatures-in-documents/
    β”‚       β”œβ”€β”€ delete-signatures-from-documents/
    β”‚       β”œβ”€β”€ generate-document-pages-preview/
    β”‚       β”œβ”€β”€ generate-signatures-preview/
    β”‚       └── signature-use-cases/
    β”œβ”€β”€ use-cases
    β”‚   β”œβ”€β”€ sign-password-protected-pdf/
    β”‚   └── signing-documents-linux-container-fonts/
    └── licensing
        β”œβ”€β”€ set_license_from_file.py
        β”œβ”€β”€ set_license_from_stream.py
        └── set_metered_license.py

Setup

  1. Create and activate a virtual environment:

    Create:

    py -m venv .venv
    
    python3 -m venv .venv
    
    python3 -m venv .venv
    

    Activate:

    .venv\Scripts\activate
    
    source .venv/bin/activate
    
    source .venv/bin/activate
    
  2. Install dependencies from Examples/requirements.txt:

    py -m pip install -r Examples/requirements.txt
    
    python3 -m pip install -r Examples/requirements.txt
    
    python3 -m pip install -r Examples/requirements.txt
    
  3. Configure a license (optional). The suite honours the GROUPDOCS_LIC_PATH environment variable. Set it in your shell before running run_all_examples.py:

    $env:GROUPDOCS_LIC_PATH = "C:\path\to\GroupDocs.Signature.lic"
    
    export GROUPDOCS_LIC_PATH="/path/to/GroupDocs.Signature.lic"
    
    export GROUPDOCS_LIC_PATH="/path/to/GroupDocs.Signature.lic"
    
    Note
    Learn more about licensing, evaluation limits, and how to obtain a free 30-day temporary license in the Licensing topic.

Run the Examples

Run the Full Suite

From the repository root, run run_all_examples.py. It runs every example in its own process, prints a status line per file, and ends with a pass/fail summary. Without a license, an example that hits an evaluation limit, such as a sample document of more than two pages, prints a note instead of failing.

py Examples\run_all_examples.py
python3 Examples/run_all_examples.py
python3 Examples/run_all_examples.py

Run a Single Example

Change into the folder that contains the script and run it directly. Input sample files live next to each script, so relative paths resolve correctly.

cd Examples/getting-started/quick-start-guide
python sign_pdf_with_text_signature.py

Examples that sign or change a document write the result into the same folder as the script. Where an example is documented on this site, the result it produces is also linked from an output tab next to the code; click it to download the file.

Run with Docker

The repository includes a Dockerfile based on python:3.13-slim. It installs the system packages the library needs on Linux (ICU, fontconfig, libgdiplus and the Microsoft core fonts) and every Python dependency, then runs the full suite. Use it when you want a clean, reproducible Linux environment without touching your host machine:

docker build -t groupdocs-signature-examples .
docker run --rm \
    -e GROUPDOCS_LIC_PATH=/license/GroupDocs.Signature.lic \
    -v /path/to/your/license:/license:ro \
    groupdocs-signature-examples

Drop the -e and -v flags to run in evaluation mode. On Windows with Git Bash, run export MSYS_NO_PATHCONV=1 first so that the mounted license path is not rewritten.

Continuous Integration

Every push triggers .github/workflows/run-examples.yml, which installs the same system packages and runs the entire example suite on ubuntu-latest with Python 3.13. Fork the repository and open a pull request: the workflow runs for free on GitHub-hosted runners and is a quick way to check local changes in a clean environment.

Troubleshooting

  • “The type initializer for ‘Gdip’ threw an exception” on Linux or macOS: install libgdiplus (Linux) or mono-libgdiplus (macOS). Stamp signatures, text rendered as an image, barcode, QR code and image signatures with a border or transparency, signatures on PowerPoint and image files, and signature previews need it. See System Requirements.
  • “Font Times New Roman was not found” or “Font Arial was not found” on Linux: install the Microsoft core fonts (ttf-mscorefonts-installer).
  • “Couldn’t find a valid ICU package”, with the Python process ending abruptly: install ICU (libicu-dev on Debian and Ubuntu).
  • “The number of pages cannot exceed 2 in a trial version”, or searches that report an evaluation notice instead of the signature’s text: you are running unlicensed. Set GROUPDOCS_LIC_PATH to a valid license file and re-run. See Licensing.
  • Anything else: see Troubleshooting, post on the free support forum, or visit the Technical Support page.

Contribute

If you would like to add or improve an example, we encourage you to contribute. All examples in this repository are open source and can be freely used in your own applications. Fork the repository, edit the example, and create a pull request; we will review the changes and include them if found helpful.

Close
Loading

Analyzing your prompt, please hold on...

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