How do I modify all hyper links in an existing PDF document to simple
a. Removing the link action surrounding the text.
b. Removing the path under the link (the underline).
c. Changing the text color to black.
To remove all hyperlinks from a page you could use
page.AnnotRemove(annot), where 'annot' is any page annotation with
type 'Annot.Type.e_Link'. Please take a look at Annotation sample
project (www.pdftron.com/net/samplecode.html#Annotation) for examples
of how to use high-level annotation API.
Removing the link underline is a bit trickier. If the underline is
part of the hyperlink object the path will be removed during
annotation removal. If the underline is part of the page content
stream you would need to search through page content stream form any
path objects (Element.Type.e_path) consisting on a single line segment
or a rectangle that lie in the given hyperlink bounding box
(Annot.GetRect()). To obtain bounding box for any element on the page
you could use element.GetBBox(). For starting ideas of how this could
be implemented please take a look at ElementEdit sample project:
For information on how to change text color under a link search for
the following topic in PDFNet Knowledge Base:
"How can I modify text color under a given rectangle"