How to search signatures with LINQ queries

GroupDocs.SignatureΒ provides LINQ query support for search process.

Here are the steps to search 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Β SearchΒ method to define search criteria, such as filtering for text signatures and matching a specific name (“John Smith”) in a case-insensitive manner.
  • Execute the search by calling theΒ SearchΒ method and passing the query.
  • Process the found signatures if needed, such as reviewing their properties or performing additional operations.

This example shows how to search Text signature with LINQ query in the document

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

// Create a new Signature instance using the specified file.
using (var signature = new Signature(filePath))
{
    // Perform a search for signatures of type Text that match the specified name.
    var signatures = signature.Search(signatureItem => 
        signatureItem.SignatureType == SignatureType.Text && 
        (signatureItem as TextSignature)?.Text.Equals("John Smith", StringComparison.OrdinalIgnoreCase) == true
    );

    // Optionally, process the found 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.