I tried searching sentences with icepdf.And got the right results most of the time.But the problems i am facing now are
I failed on searching for sentences which starts with one line and ends in the next line. Is there any solution for finding the same? I tried splitting those sentences and searching them separately.But it may cause more problems.
And finally, is there any method by which i can know the line numbers on which i got the search key matched. Please help.
Loop through all the lines in the document and create a list of a sentences. Each sentence can be a list of
WordText
objects. Then search through the list of lists you have created to find your sentence.Here is some example code (I have not checked as of now) to build the list of lists of
WordText
objects.If you need to sort your WordText lists, you can compare the WordText objects y and then x values.