How to verify signatures with LINQ queries

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.