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

后端 未结 2 579
独厮守ぢ
独厮守ぢ 2021-01-03 13:58

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

Already i have tried

AnnotationDictionary.Remove(PdfName.LIN         


        
2条回答
  •  有刺的猬
    2021-01-03 14:34

    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);
    
    }
    

提交回复
热议问题