Sign and verify documents with GroupDocs.Signature

GroupDocs.Signature applies electronic signatures to a document and finds them again afterwards. It supports text, image, digital certificate, barcode, QR-code, stamp, metadata and form-field signature types across PDF, Word, Excel, PowerPoint and image formats.

The three examples below cover the full lifecycle: sign, verify, search.

Sign a document with a text signature

A text signature draws text onto the page at a position you choose. Left/Top place it, Width/Height bound it.

using GroupDocs.Signature;
using GroupDocs.Signature.Options;

using (Signature signature = new Signature("contract.pdf"))
{
    TextSignOptions signOptions = new TextSignOptions("John Smith")
    {
        Left = 100,
        Top = 100,
        Width = 200,
        Height = 40
    };

    signature.Sign("signature-sign-with-text.pdf", signOptions);
}

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

Binary file (PDF, 216 KB)

Download full output

Sign a document with a QR code

A QR-code signature encodes arbitrary text — an approval id, a verification URL — into a scannable code placed on the page.

using GroupDocs.Signature;
using GroupDocs.Signature.Domain;
using GroupDocs.Signature.Options;

using (Signature signature = new Signature("contract.pdf"))
{
    QrCodeSignOptions signOptions = new QrCodeSignOptions("Approved by John Smith")
    {
        EncodeType = QrCodeTypes.QR,
        Left = 100,
        Top = 100,
        Width = 120,
        Height = 120
    };

    signature.Sign("signature-sign-with-qr-code.pdf", signOptions);
}

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

Binary file (PDF, 159 KB)

Download full output

Search a document for signatures

Searching answers “what is on this document?”. It returns every signature of the type you ask for, with its page and position.

using System;
using System.Collections.Generic;
using GroupDocs.Signature;
using GroupDocs.Signature.Domain;
using GroupDocs.Signature.Options;

// Sign first, so there is something to find
using (Signature signature = new Signature("contract.pdf"))
{
    QrCodeSignOptions signOptions = new QrCodeSignOptions("Approved by John Smith")
    {
        Left = 100,
        Top = 100
    };
    signature.Sign("signature-search.pdf", signOptions);
}

using (Signature signature = new Signature("signature-search.pdf"))
{
    QrCodeSearchOptions searchOptions = new QrCodeSearchOptions();
    List<QrCodeSignature> signatures = signature.Search<QrCodeSignature>(searchOptions);

    Console.WriteLine("Signatures found: " + signatures.Count);

    foreach (QrCodeSignature qrSignature in signatures)
    {
        Console.WriteLine("Type: " + qrSignature.EncodeType.TypeName
                          + ", text: " + qrSignature.Text
                          + ", page: " + qrSignature.PageNumber);
    }
}

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

Binary file (PDF, 159 KB)

Download full output

Learn more

GroupDocs.Signature also applies digital certificate signatures, image and stamp signatures, metadata and form-field signatures; verifies a document against expected signature values; and updates or deletes signatures already present.

Close
Loading

Analyzing your prompt, please hold on...

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