首页 > 解决方案 > 提取 FDF 注释

问题描述

我的机器中保存了 FDF 文件,我想从 fdf 中提取注释。我在 C# 中使用 Itextsharp。

我找到了PDF阅读器方法。我不知道如何将 FDF 阅读器文件转换为 pdf 阅读器

using (FdfReader fdfReader = new FdfReader(FdfFileLocation))
                {
                    FdfReader fdfReaderas = new FdfReader(FdfFileLocation); 
                    int fr = fdfReader.NumberOfPages;
                    //annotsReader = new PdfReader(formLocation);
                    for (int page = 1; page <= fdfReaderas.NumberOfPages; ++page)
                    {
                        PdfDictionary pagedic = fdfReaderas.GetPageN(page);
                        PdfArray annotarray = (PdfArray)PdfReader.GetPdfObject(pagedic.Get(PdfName.ANNOTS));

                        if (annotarray == null || annotarray.Size == 0)
                            continue;
                        int couter = 1;
                        foreach (PdfObject A in annotarray.ArrayList)
                        {
                            couter++;

                            PdfDictionary AnnotationDictionary = (PdfDictionary)PdfReader.GetPdfObject(A);
                            PdfString AnnotationTitle = AnnotationDictionary.GetAsString(PdfName.T);
                            PdfString AnnotationContent = AnnotationDictionary.GetAsString(PdfName.CONTENTS);
                        }
                    }

无论如何我们可以从 fdf 文件中找到注释吗

标签: c#itext

解决方案


推荐阅读