We noticed the similar issue at our end while using Aspose.PDF for .NET 21.1. Please note that you need to use regular expressions in order to extract/search multiline text or text with a line break. So we used below code snippet:
Document doc = new Document(dataDir + "DriveToPdf.pdf");
TextFragmentAbsorber absorber = new TextFragmentAbsorber(@"(i?)This\s*is\s*a\s*test\s*document\s*which\s*contains\s*some\s*data\s*click\s*here\s*to\s*go\s*to\s*destination\s*click\b", new TextSearchOptions(true));
if(absorber.TextFragments.Count > 0)
foreach(var tf in absorber.TextFragments)
LinkAnnotation link = new LinkAnnotation(tf.Page, tf.Rectangle);
link.Action = new GoToAction(doc.Pages);
doc.Save(dataDir + "output.pdf");
The API was unable to find the text. We used
TextAbsorber to see in which format the text was present in the PDF and found that it was extracted as below:
This is a test document that contains some data click here to go to 2
We tried to change the regular expression accordingly but still did not get much success. Therefore, have logged an issue as PDFNET-49312 in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.
We are sorry for the inconvenience.