Verify for multiple signatures

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Signature MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-signature -- dnx GroupDocs.Signature.Mcp --yes
Folders, licensing and more →

Overview

GroupDocs.Signature supports verification of documents for different signature types. This approach requires to add all required verification options to list.

Here are the steps to verify document for multiple signatures with GroupDocs.Signature:

This example shows how to verify the document for different signature types.

from groupdocs.signature import Signature
from groupdocs.signature.domain import TextMatchType, TextSignatureImplementation
from groupdocs.signature.options import (BarcodeVerifyOptions, DigitalVerifyOptions, QrCodeVerifyOptions,
                                         TextVerifyOptions)


def verify_multiple_signature_types():
    with Signature("signed.pdf") as signature:
        # Text signature that contains "John"
        text_options = TextVerifyOptions()
        text_options.all_pages = True  # this value is set by default
        text_options.signature_implementation = TextSignatureImplementation.NATIVE
        text_options.text = "John"
        text_options.match_type = TextMatchType.CONTAINS

        # Barcode signature that contains "12345"
        barcode_options = BarcodeVerifyOptions()
        barcode_options.text = "12345"
        barcode_options.match_type = TextMatchType.CONTAINS

        # QR code signature that contains "John"
        qr_code_options = QrCodeVerifyOptions()
        qr_code_options.text = "John"
        qr_code_options.match_type = TextMatchType.CONTAINS

        # Digital signature made with this certificate for the reason "Approved"
        digital_options = DigitalVerifyOptions("certificate.pfx")
        digital_options.password = "1234567890"
        digital_options.reason = "Approved"

        result = signature.verify([text_options, barcode_options, qr_code_options, digital_options])

        if result.is_valid:
            print("Document was verified successfully!")
        else:
            print("Document failed verification process.")
        for verified in result.succeeded:
            print(f"Verified {verified.signature_type.name} signature")


if __name__ == "__main__":
    verify_multiple_signature_types()

signed.pdf is the sample file used in this example. Click here to download it.

certificate.pfx is the sample file used in this example. Click here to download it.

Document was verified successfully!
Verified TEXT signature
Verified BARCODE signature
Verified QR_CODE signature
Verified DIGITAL signature

Download full output

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Apps

Along with the full-featured Python library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.