Q: I need to be able to use an API from c# to:
1. Search for certain text in an existing unsecure, unencrypted PDF
2. Make that text a “web link” – make it look and respond as a
hyperlink would in a browser (blue text, underline, cursor changes to
“pointer” when hovers above it) and when clicked open a browser window
and navigate to a URL (known in processing time).
A: You can use PDFNet SDK (http://www.pdftron.com/pdfnet) to implement
To search PDF for text use ‘pdftron.PDF.TextExtractor’ as shown in
TextExtract sample project (http://www.pdftron.com/pdfnet/
samplecode.html#TextExtract). Using TextExtractor you can iterate
through each word on a page and obtain its bounding box.
The bounding box for the word can be used to create a highlight
annotation (for a concrete example please take a look at Annotation
sample project [http://www.pdftron.com/pdfnet/
samplecode.html#TextExtract] and search for ‘hyperlink’).
You may also want to search for relevant sample code in PDFNet KB
(http://groups.google.com/group/pdfnet-sdk) for “highlight text”.
Although this sample code creates highlight annotation, creating a
hyperlink would be only a minor tweak to the code.