[PDFNet] How do I search and hyperlink text in PDF?

Q: What I am looking to do is search a PDF file for a list of
keywords. If any of the words are found I would like to embed a link
behind or over the word. In other words change the word itself to a
link. It could look either like a table of contents link or an actual
weblink. I wasn’t able to find any sample code on the site. Do you
have any advice or sample code that would be able to assist me with
this issue?
A: To find words on the page you can use
‘pdftron.PDF.TextExtractor’ (please see TextExtract sample project
http://www.pdftron.com/pdfnet/samplecode.html#TextExtract). If you are
using the latest version of PDFNet (v.5 or higher) you can also use
‘pdftron.PDF.TextSearch’ which can be used to quickly find text on a
PDF page using regular expressions (please see TextSearch sample which
is included as another sample as part of SDK distribution).

After you find the text you can use its bounding box (or quad) to
create a hyperlink annotation. For an example of how to add a
hyperlink please see Annotation sample project (http://www.pdftron.com/

For example:

Link mylink = new pdftron.Annots.Link(doc, boundingBox);
mylink.SetBorderStyle(new Annot.BorderStyle
(Annot.BorderStyle.e_underline, 1,0,0));
mylink.SetAction(Action.CreateURI(doc, "http://www.pdftron.com",

You received this message because you are subscribed to the "PDFTron PDFNet SDK" group. To post to this group, send email to support@pdftron.com
To unsubscribe from this group, send email to pdfnet-sdk-unsubscribe@googlegroups.com. For more information, please visit us at http://www.pdftron.com