How to Search for QR Code Signatures

When you search for electronic signatures of QR-Code type inside a document with GroupDocs.Signature for Python via .NET, you only need to pass a QrCodeSearchOptions object to the search method.

Here’s a quick guide on how to search for QR-code signatures:

The code snippet below demonstrates how to search for QR-code signatures in a document using Python:

import groupdocs.signature as signature
from groupdocs.signature.options import QrCodeSearchOptions
import groupdocs.signature.domain as gsd
# Initialize signature
with signature.Signature("sample.pdf") as sign:
    # Search for signatures in document
    signatures = sign.search(gsd.SignatureType.QR_CODE)
    
    print("\nSource document contains the following signatures:")
    for qr_code_signature in signatures:
        print(f"QR Code signature found at page {qr_code_signature.page_number} "
              f"with type {qr_code_signature.encode_type} and text {qr_code_signature.text}")

Advanced Search Options

Here’s an example showing how to use more advanced search options for QR codes:

import groupdocs.signature as signature
from groupdocs.signature.options import QrCodeSearchOptions
from groupdocs.signature.domain import QrCodeTypes

# Initialize signature
with signature.Signature("sample.pdf") as sign:
    # Create search options
    search_options = QrCodeSearchOptions()
    
    # Search on specific pages
    search_options.page_number = 1
    search_options.all_pages = False
    
    # Search for specific QR code type
    search_options.encode_type = QrCodeTypes.QR
    
    # Search for specific text in QR code
    search_options.text = "John"
    
    # Search document
    signatures = sign.search(search_options)
    
    # Process found signatures
    for qr_code_signature in signatures:
        print(f"Found QR Code signature: {qr_code_signature.text}")
        print(f"Page number: {qr_code_signature.page_number}")
        print(f"Position: X={qr_code_signature.left}, Y={qr_code_signature.top}")
        print(f"Size: {qr_code_signature.width}x{qr_code_signature.height}")
        print(f"Encode type: {qr_code_signature.encode_type}")
        print(f"Error correction level: {qr_code_signature.error_correction_level}")

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.