This article describes how to run Python digital signature API code examples.
Warning
Before running an example make sure that GroupDocs.Signature has been installed successfully.
We offer multiple solutions on how you can run GroupDocs.Signature examples, by building your own or using our examples out-of-the-box.
Please choose one from the following list:
Build project from scratch
Create a new Python project directory and set up a virtual environment:
# Create project directorymkdir signature_project
cd signature_project
# Create and activate virtual environmentpython -m venv venv
# On Windows:venv\Scripts\activate
# On macOS/Linux:source venv/bin/activate
# Install GroupDocs.Signaturepip install groupdocs-signature-net
Create a new Python file (e.g., main.py) and code your first application with GroupDocs.Signature for Python like this:
importgroupdocs.signatureassignature# The path to the documents directory.file_path="sample.docx"# NOTE: Put here actual path for your documentoutput_file_path="output/signed.docx"# Sign document with text signaturesignature_handler=signature.Signature(file_path)text_sign_options=signature.TextSignOptions("John Smith")signature_handler.sign(output_file_path,text_sign_options)
Run your project:
python main.py
Signed document will appear in the “output” directory.
Run examples from GitHub
The complete examples package of GroupDocs.Signature for Python is hosted on GitHub. You can either download the ZIP file or clone the repository:
git clone https://github.com/groupdocs-signature/GroupDocs.Signature-for-Python-via-.NET.git
cd GroupDocs.Signature-for-Python-via-.NET
To run the examples:
Set up a virtual environment and install dependencies:
python -m venv venv
# On Windows:venv\Scripts\activate
# On macOS/Linux:source venv/bin/activate
pip install -r requirements.txt
Navigate to the examples or select example which you like and execute:
cd Examples
python run_examples.py
Run from Docker
Use Docker image to try GroupDocs.Signature for Python features in an easy way. Here are the commands to run GroupDocs.Signature for Python from docker image:
mkdir DocumentSamples
mkdir Licenses
docker run -p 5000:5000 \
--env APPLICATION_HOST_ADDRESS=localhost \
-v $(pwd)/DocumentSamples:/home/groupdocs/app/DocumentSamples \
-v $(pwd)/Licenses:/home/groupdocs/app/Licenses \
groupdocs/signature-python
# Open http://localhost:5000 in your favorite browser
Contribute
If you 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. To contribute, you can fork the repository, edit the code and create a pull request. We will review the changes and include it in the repository if found helpful.
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.