GroupDocs.Signature for Python via .NET provides a powerful API for working with different electronic signature types such as Text, Image, Digital, Barcode, QR-code, Stamp, Form Field, and Metadata. These e-signatures can be added to documents, updated, deleted, verified, or searched within already signed documents. Our product also provides information about document type and structure - file type, size, pages count, etc. and generates document pages preview based on provided options.
Main Concepts
The Signature class is the main entry point that contains all required methods for manipulating document e-signatures.
Most methods expect different options objects for signing documents, verifying and searching electronic signatures.
The Signature class is a context manager: use it in a with block to ensure all document streams are safely closed when operations are completed.
Installation
Install the package using pip:
pip install groupdocs-signature-net
Required Imports
Import each class from the module that defines it. The package root exports Signature, SignatureSettings, License and the exception types; options, signatures and their helpers live in sub-modules:
fromgroupdocs.signatureimportSignature,License# entry point, licensing, exceptionsfromgroupdocs.signature.optionsimportTextSignOptions# sign, search, verify and preview optionsfromgroupdocs.signature.domainimportSignatureFont# signatures, enumerations and helpersfromgroupdocs.signature.domain.extensionsimportTextShadow# signature extensionsfromgroupdocs.pydrawingimportColor# colors
Basic Usage Example
The following code shows the most common pattern to define a Signature object and call its methods:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportTextSignOptions# Sign document with text signaturewithSignature("sample.docx")assignature:text_sign_options=TextSignOptions("John Smith")signature.sign("SampleSigned.docx",text_sign_options)
Key Features
Document Signing: Add various types of signatures to your documents
Signature Search: Find existing signatures in documents
Signature Verification: Verify the authenticity of signatures
Signature Update: Modify existing signatures
Signature Deletion: Remove signatures from documents
Document Information: Get details about document structure
Document Preview: Generate previews of document pages
Please check the detailed examples in the following guides to learn how to:
Sign documents with different signature types
Search and verify document signatures
Update and delete signatures
Generate document previews
Get document information
Here are main GroupDocs Signature API concepts:
Signature is the main class that contains all required methods for manipulating with document e-signatures.
Most part of methods expects different options to eSign document, verify and search electronic signatures inside document.
Signature class is a context manager: use it in a with block to correctly release used resources - like safely closing document streams when all operations completed.
Referencing required namespaces
You can also import the modules themselves and refer to the classes through them:
The following code shows most used code pattern to define Signature object and call its methods.
importgroupdocs.signatureasgsimportgroupdocs.signature.optionsasgso# Get document information and sign the document with a text signaturewithgs.Signature("sample.docx")assignature:info=signature.get_document_info()print(f"Pages: {info.page_count}")result=signature.sign("SampleSigned.docx",gso.TextSignOptions("John Smith"))print(f"Signatures added: {len(result.succeeded)}")
Please check detailed examples of how to eSign documents, search and verify document signatures in the following guides: