How do I remove link annotations from a PDF using iText?

不想你离开。 提交于 2019-12-03 23:11:35

问题


Here i want to remove Annotation(Link, Text, ..) from PDF permanently using iTextSharp.

Already i have tried

AnnotationDictionary.Remove(PdfName.LINK);

But that Link annotations exist in that PDF.

Note:

I want remove particular selected Annotations(Link, Text, ..), For Example i want remove Link Annotation with the URI as www.google.com, remaining Link Annotations i want to be retain as per exist.


回答1:


I got the answer for my question.

Sample Code:

//Get the current page
PageDictionary = R.GetPageN(i);

//Get all of the annotations for the current page
Annots = PageDictionary.GetAsArray(PdfName.ANNOTS);

foreach (PdfObject A in Annots.ArrayList)
{
//code to check the annotation 

//remove the annotation
Annots.Remove(int idx);

}


来源:https://stackoverflow.com/questions/18974031/how-do-i-remove-link-annotations-from-a-pdf-using-itext

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!