Articles in this section
Category / Section

How to remove hyperlink from existing PDF document in WinForms?

1 min read

In WinForms PDF, you can remove the hyperlink from existing document by using the “Remove” method available in the class “PdfLoadedAnnotationCollection”class. Please find the code snippet to remove the hyperlink from the existing document.

 

[C#]
 
//Load the file
PdfLoadedDocument lDoc = new PdfLoadedDocument("../../Data/TextWebLink.pdf");
 
for (int i = 0; i < lDoc.Pages.Count; i++)
{
//get the annotation collection
PdfAnnotationCollection annotColl = lDoc.Pages[i].Annotations as PdfLoadedAnnotationCollection;
 
for (int j = 0; j < annotColl.Count; j++)
{
//Get the annotaion
PdfLoadedAnnotation annot = annotColl[j] as PdfLoadedAnnotation;
 
 
if (annot is PdfLoadedTextWebLinkAnnotation || annot is PdfLoadedUriAnnotation)
{
 
//remove the hyperlinks
annotColl.Remove(annot);
 
}
}
 
}
 
lDoc.Save("Sample.pdf");
lDoc.Close(true);
 

 

Sample:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/RemoveHyperlink-1083323766

 

Conclusion

I hope you enjoyed learning about how to remove hyperlink from existing PDF document in WinForms.

You can refer to our WinForms PDF feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied