Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using (Signature signature = new Signature(sample.pdf))
{
// setup search options
ImageSearchOptions searchOptions = new ImageSearchOptions()
{
// specify special pages to search on
AllPages = false,
// single page number
PageNumber = 1,
// setup extended search in pages setup
PagesSetup = new PagesSetup() { FirstPage = true, LastPage = true, OddPages = false, EvenPages = false }
};
// search document
List<ImageSignature> signatures = signature.Search<ImageSignature>(searchOptions);
// output signatures
foreach (ImageSignature imageSignature in signatures)
{
if (imageSignature != null)
{
Console.Write($"Found Image signature with size {imageSignature.Size}.");
Console.WriteLine($"Location at {imageSignature.Left}-{imageSignature.Top}. Size is {imageSignature.Width}x{imageSignature.Height}.");
}
}
}
using (Signature signature = new Signature(sample.pdf))
{
// setup search options
TextSearchOptions searchOptions = new TextSearchOptions()
{
// specify special pages to search on
AllPages = false,
// single page number
PageNumber = 1,
// setup extended search in pages setup
PagesSetup = new PagesSetup() { FirstPage = true, LastPage = true, OddPages = false, EvenPages = false },
// specify text match type
MatchType = TextMatchType.Exact,
// specify text pattern to search
Text = "John Smith"
};
// search document
List<TextSignature> signatures = signature.Search<TextSignature>(searchOptions);
// output signatures
foreach (TextSignature textSignature in signatures)
{
if (textSignature != null)
{
Console.Write($"Found Text signature: {textSignature.SignatureImplementation} with text {textSignature.Text}.");
Console.WriteLine($"Location at {textSignature.Left}-{textSignature.Top}. Size is {textSignature.Width}x{textSignature.Height}.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment