Callย Searchย method ofย Signature class instance and pass search options in it.
Implement method for SearchStarted event
GroupDocs.Signature expectsย ProcessStartEventHandler delegate to subscribe for SearchStarted event
privatestaticvoidOnSearchStarted(Signaturesignature,ProcessStartEventArgsargs){Console.WriteLine("Search process started at {0} with {1} total signatures to be put in document",args.Started,args.TotalSignatures);}
Implement method for SearchProgress event
privatestaticvoidOnSearchProgress(Signaturesignature,ProcessProgressEventArgsargs){Console.WriteLine("Search progress. Processed {0} signatures. Time spent {1} mlsec",args.ProcessedSignatures,args.Ticks);}
Implement method for SearchCompleted event
privatestaticvoidOnSearchCompleted(Signaturesignature,ProcessCompleteEventArgsargs){Console.WriteLine("Search process completed at {0} with {1} total signatures. Process took {2} mlsec",args.Completed,args.TotalSignatures,args.Ticks);}
Subscribing for search process events
privatestaticvoidOnSearchStarted(Signaturesender,ProcessStartEventArgsargs){Console.WriteLine("Search process started at {0} with {1} total signatures to be put in document",args.Started,args.TotalSignatures);}privatestaticvoidOnSearchProgress(Signaturesender,ProcessProgressEventArgsargs){Console.WriteLine("Search progress. Processed {0} signatures. Time spent {1} mlsec",args.ProcessedSignatures,args.Ticks);}privatestaticvoidOnSearchCompleted(Signaturesender,ProcessCompleteEventArgsargs){Console.WriteLine("Search process completed at {0} with {1} total signatures. Process took {2} mlsec",args.Completed,args.TotalSignatures,args.Ticks);}publicstaticvoidRun(){using(Signaturesignature=newSignature("SignedSample.pdf")){signature.SearchStarted+=OnSearchStarted;signature.SearchProgress+=OnSearchProgress;signature.SearchCompleted+=OnSearchCompleted;BarcodeSearchOptionsoptions=newBarcodeSearchOptions(){// specify special pages to search onAllPages=true};// search for signatures in documentList<BarcodeSignature>signatures=signature.Search<BarcodeSignature>(options);Console.WriteLine("\nSource document contains following signatures.");foreach(varbarcodeSignatureinsignatures){Console.WriteLine("Barcode signature found at page {0} with type {1} and text {2}",barcodeSignature.PageNumber,barcodeSignature.EncodeType,barcodeSignature.Text);}}}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in ourย GitHub examples: