How to verify signatures with predicate functions

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 →

GroupDocs.Signature provides LINQ query support for verification process.

Here are the steps to verify Barcode signature within the document with GroupDocs.Signature:

  • Create new instance of Signature class and pass source document path as a constructor parameter.
  • Use a LINQ query inside the Verify method method to define verification criteria, such as checking that the signature type is Barcode and that the SignatureId equals “123”.
  • Execute the verification by calling the Verify method and passing the query.
  • Process the verification result by iterating through the returned signatures if needed.

This example shows how to verify Barcode signature with LINQ query in the document

// Define the path to the PDF file.
string filePath = Constants.SAMPLE_PDF;
string fileName = Path.GetFileName(filePath);

// Use the 'using' statement for automatic resource management.
using (var signature = new Signature(filePath))
{
    // Perform a varify to validate signatures of type Barcode with a specific SignatureId.
    var signatures = signature.Verify(signatureItem => 
        signatureItem.SignatureType == SignatureType.Barcode && 
        signatureItem.SignatureId.Equals("123", StringComparison.Ordinal)
    );
   // Optionally, process the verified signatures here.
}

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 .NET 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.