如何使用iText从PDF中删除链接注释? [英] How do I remove link annotations from a PDF using iText?
本文介绍了如何使用iText从PDF中删除链接注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在这里,我想永久使用iTextSharp从PDF中删除Annotation(Link,Text,..)。
Here i want to remove Annotation(Link, Text, ..) from PDF permanently using iTextSharp.
我已经尝试过了
AnnotationDictionary.Remove(PdfName.LINK);
但该PDF中存在链接注释。
But that Link annotations exist in that PDF.
注意:
我想删除特定的选定注释(链接,文字,..),
例如我想要删除链接注释,其URI为www.google.com,剩余的链接注释我希望按照存在的方式保留。
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.
推荐答案
我得到了我的问题的答案。
I got the answer for my question.
示例代码:
//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);
}
这篇关于如何使用iText从PDF中删除链接注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文