我們很高興宣佈 GroupDocs.Parser for .NET 26.7 已於 2026年7月 發佈。

本次發佈的新功能

摘要 類別
PARSERNET-2890 實作從 PDF 文件中提取註釋的功能 改進
PARSERNET-2891 實作 .NET 6、.NET 8、.NET 10 的 NuGet 套件 改進

公開 API 變更

實作從 PDF 文件中提取註釋的功能

已在 GroupDocs.Parser.Data 命名空間中新增類別 AnnotationItem
已在 GroupDocs.Parser.Data.AnnotationItem 類別中新增屬性 System.String Value

已在 GroupDocs.Parser.Options.Features 類別中新增屬性 Boolean Annotations
已在 GroupDocs.Parser.Options.TextOptions 類別中新增屬性 Boolean IncludeAnnotations

已在 GroupDocs.Parser.Parser 類別中新增方法 System.Collections.Generic.IEnumerable<GroupDocs.Parser.Data.AnnotationItem> GetAnnotations()
已在 GroupDocs.Parser.Parser 類別中新增方法 System.Collections.Generic.IEnumerable<GroupDocs.Parser.Data.AnnotationItem> GetAnnotations(Int32)

實作 .NET 6、.NET 8、.NET 10 的 NuGet 套件

公開 API 變更:無。

程式碼範例

同時提取註釋與完整文字

using (Parser parser = new Parser("C:\\MyDocuments\\MyFile.pdf"))
{
    TextOptions options = new TextOptions()
    {
        IncludeAnnotations = true
    };
    using (TextReader reader = parser.GetText(options))
    {
        string text = reader.ReadToEnd();
        Console.WriteLine(text);
    }
}

分別提取註釋

using (Parser parser = new Parser("C:\\MyDocuments\\MyFile.pdf"))
{
    IEnumerable<AnnotationItem> annotations = parser.GetAnnotations();
    foreach (AnnotationItem annotation in annotations)
    {
        Console.WriteLine(annotation.Value);
    }
}

如何取得更新

NuGet

安裝路由套件 — 它會自動為您的平台選擇相應的套件: