Q: I am currently using PDFNet in order to build an application that
provides users with an alternative way of viewing PDF files.
I am using PDFNet to read all of the text from the file and store in a
database for fast searching of files within an asset management system.
So far so good. I now have 2 more features that I need to add and was
wondering if you may be able to tell me if these are possible with this
1. When I search for some text in the document and click on the search
result it takes me to the page, but I would like to highlight the word.
Is there a way in PDFNet of finding the exact location of a word on a
page, or can you only find where the text box is that the text is in?
2. Can you find hyperlinks in PDF files, both where they are and where
they go to?
Is there a way in PDFNet of finding the exact location of a word on a page
If you use ElementReader class to extract 'text-run' you can use
element.GetBBox(rect) method to obtain the bounding box of the element
in PDF page coordinate system. You can also use this rectangle to
highlight the text on the page.
Can you find hyperlinks in PDF files, both where they are and where they go to?
In PDF format, hyperlinks are represented as Annot.Type.e_Link
annotations floating on top the page. You can access page annotation
using page.GetAnnots() method (please see Annotation sample project
http://www.pdftron.com/net/samplecode.html#Annotation for more
In case you are interested in using built-in PDF viewer (i.e. PDFView
class) we are also planning to provide basic text search and annotation
editing functionality as a built-in option soon.