问题
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