使用itextsharp读取图形注释 [英] Reading graphic annotations with itextsharp

查看:113
本文介绍了使用itextsharp读取图形注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用ITextSharp阅读PDF的自由绘图(铅笔)注释。我可以得到注释,但不知道如何获得线条绘制的图形。



我尝试过:



< pre> for(int i = 1; i< = reader.NumberOfPages; i ++)
{

PdfDictionary page = reader.GetPageN(i);
PdfArray annotsArray = null;

if(page.GetAsArray(PdfName.ANNOTS)== null)
continue;

annotsArray = page.GetAsArray(PdfName.ANNOTS);
for(System.util.ListIterator< PdfObject> iter = annotsArray.GetListIterator(); iter.HasNext();)
{

PdfDictionary annot =(PdfDictionary)PdfReader .GetPdfObject(iter.Next());

}
}

解决方案

对于iTextSharp的所有常见问题,这看起来都是一个很好的资源:常见问题的开发人员问题(iText 5)| iText开发人员 [ ^ ]



这可能会指向正确的方向: c# - 使用iTextSharp读取PDF文件附件注释 - 堆栈溢出 [ ^ ]



(使用此搜索找到:使用ITextSharp读取PDF的图像注释 -

Google搜索
[ ^ ])

I need to read the free draw (pencil) annotations of a PDF using ITextSharp. I can get the annotations but do not know how to get the line drawn graphics.

What I have tried:

<pre>        for (int i = 1; i <= reader.NumberOfPages; i++)
        {

            PdfDictionary page = reader.GetPageN(i);
            PdfArray annotsArray = null;

            if (page.GetAsArray(PdfName.ANNOTS) == null)
                continue;

            annotsArray = page.GetAsArray(PdfName.ANNOTS);
            for (System.util.ListIterator< PdfObject > iter = annotsArray.GetListIterator(); iter.HasNext();)
            {

                PdfDictionary annot = (PdfDictionary)PdfReader.GetPdfObject(iter.Next());

            }
        }

解决方案

This looks like a good resource for all common questions for iTextSharp: Frequently asked developer questions (iText 5) | iText Developers[^]

And this may point you in the right direction: c# - Reading PDF File Attachment Annotations with iTextSharp - Stack Overflow[^]

(found using this search: read image annotations of a PDF using ITextSharp -
Google Search
[^])


这篇关于使用itextsharp读取图形注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆