Hey,
I have a need to search for text fragments in a PDF page and convert these to navigable Hyperlinks.
Using: string documentContent = provider.Export(document); to export the full PDF document text fragments finds the text fragments properly, but is unusable as it doesn't preserve the content element that contains the text as I am required to insert a link at the same positional data.
I have also tried this code snippet with no luck as it seems to only return individual character data. The provider.Export(...) method does return the text fragments that are being searched properly, but how to enumerate the text elements in a page similar to what Export() is doing is where I need help with.
What is wrong with the method below for processing out the text fragments? Apparently the provider.Export() method that is baked in has another way of reading and forming the full text fragments that I need to copy or mimic as to preserve the positional information for the text fragment.
private void SearchTextFragment(RadFixedDocument document, string searchText)
{
foreach (var page in document.Pages)
{
foreach (var contentElement in page.Content)
{
if (contentElement is TextFragment)
{
string text = (contentElement as TextFragment).Text;
if (text.IgnoreCaseEqual(searchText))
{
}
}
}
}
}