I have a PDF file, It contains multiple HyperLink, I want to remove Link Annotation Using Aspose.PDF for NET, But i found that if the Link Annotation text is a HyperLink, Aspose can’t remove it’s Link Annotation.More detail can see the demo.pdf file.
Version info:Aspose.PDF for Net 22.12
The demo code:
var doc = new Aspose.Pdf.Document(@"C:\demo.pdf");
doc.Pages.ToList().ForEach(page =>
{
page.Annotations.ToList().ForEach(annotation =>
{
if (annotation.AnnotationType == AnnotationType.Link)
{
page.Annotations.Delete(annotation);
}
});
});
doc.Save(@"C:\output.pdf");
The demo file:
demo.pdf (33.6 KB)
The output file:
output.pdf (32.2 KB)
@sullivan
We have checked the output file shared by you and did not notice any link in it. Are you talking about the text formatting? Can you please share the screenshot of the issue that you are noticing at your end?
When i open the output file using Adobe Acrobat Render and mouse over the HyperLink text,We can see that can be click.
The screenshot:
20221231232351.png (32.9 KB)
@sullivan
If you check the PDF in Adobe Reader, it would not show that it has any link annotation inside it after removing it through Aspose.PDF. It is default behavior of Adobe Reader and other PDF viewer that they render text as link such as https://aspose.com
, www.aspose.com
, file://d:/somefile.pdf
and unfortunately this cannot be overridden using the API.