We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Search value against seacrh criteria

Hi,

We are evaluating Aspose for one of our requirement to search value against some text search. We have pdf where values are like: 1A SearchCriterea Value123

We want If we search using text "SearchCriterea" then we should get the value "Value123".

Kindly advise

Hi Abhinandan,


Thanks for your inquiry. Aspose.Pdf supports regular expression for searching text, based on some custom criteria. Please check following regular expression to search text following to the regex match. You may refine it as per your need, hopefully it will help you to accomplish the task.

TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(@"(?<=word).*");<o:p></o:p>


Please feel free to contact us for any further assistance.


Best Regards,

Thanks Tilal,

It worked but encountered with another issue in the same. It seems TextFragmentCollection holds only 4 TextFragment items.

I tried with 3 search options and found only 4 fragments while collection was shoing counts of 17, 9 etc.

Kindly advise.

Below is the code piece I am using:

TextFragmentAbsorber

textFragmentAbsorber = new TextFragmentAbsorber(@"(?<=Interest Rate)((.)*)");

TextSearchOptions textSearchOptions = new TextSearchOptions(true);

textFragmentAbsorber.TextSearchOptions = textSearchOptions;

pdfDocument.Pages.Accept(textFragmentAbsorber);

TextFragmentCollection

textFragmentCollection = textFragmentAbsorber.TextFragments;

//loop through the fragments

foreach (TextFragment textFragment in textFragmentCollection)

{

}

v

Hi Abhinandan,

Thanks for your feedback. Aspose.Pdf evaluation version has two limitations, evaluation watermark and at most four elements of any collection can be viewed. Please make a request for 30 days temporary license to evaluate our product without any limitation. Hopefully your issue will be resolved.

Please feel free to contact us for any further assistance.

Best Regards,