GroupDocs 很自豪地宣佈公開發布下一代 GroupDocs.Annotation Cloud 17.12。 它基於適用於 .NET 的 GroupDocs.Annotation,因此可以為雲中的註釋功能提供相同的經過驗證的可預測結果。 GroupDocs.Annotation Cloud 是一個 RESTful API,可操作所有常見業務文件格式的註釋。它允許開發人員在任何跨平台應用程序中管理對特定單詞、短語和文檔內容區域的交互式和解釋性註釋。它支持所有主要的文本和圖形註釋,最重要的是,它提供這些註釋功能而無需安裝任何第三方軟件。請查看 發行說明 以獲取 GroupDocs.Annotation Cloud 第一個版本的完整功能列表。以下部分描述了有關這些功能的一些詳細信息。

導入註釋

在操作註釋時,從文檔導入註釋是應用程序的基本要求。您可以使用以下 REST API 輕鬆導入註釋,它將註釋列為 AnnotationInfo Object。為此,請參閱以下 URI、REST 命令 (Curl) 和 .NET SDK 示例。統一資源標識符

https://api.groupdocs.cloud/v1/annotation/{filename}/annotations

其餘示例(cURL)

curl -v "https://api.groupdocs.cloud/v1/annotation/Annotated.pdf/annotations" \
-X GET \
-H "Content-Type: application/json" \
-H "authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” 

.NET SDK 示例

//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
var configuration = new Configuration
{
    AppSid = Sid,
    AppKey = Key
};

var apiInstance = new AnnotationApi(configuration);

try
{
    var request = new GetImportRequest()
    {
        Name = "Annotated.pdf",
        Folder = null,
        Password = null
    };

    // Import annotations from document
    var response = apiInstance.GetImport(request);
    foreach (var entry in response)
        Debug.Print("Box :" + entry.Box);
}
catch (Exception e)
{
    Debug.Print("Exception when getting Annotation Information: " + e.Message);
} 

導出註釋

GroupDocs.Annotation Cloud REST API,用於在支持的文檔中添加圖形和文本註釋。您可以使用以下API向文檔添加(導出)註釋。它期望請求正文中存在 AnnotationInfo 對象。為此,請參閱以下 URI、JSON 請求數據、REST 命令(Curl)和 .NET SDK 示例。統一資源標識符

https://api.groupdocs.cloud/v1/Annotation/{filename}/html/pdf

請求數據

[{"creatorName":"Anonym A.","box":{ "x":173.0, "y":154.89, "width":142.5, "height":9.0 },"pageNumber":0,"annotationPosition":{ "x":173.0, "y":154.88999938964844 },"svgPath":"[{'x':173.2986,'y':687.5769},'x':315.7985,'y':687.5769},{'x':173.2986,'y':678.5769},{'x':315.7985,'y':678.5769}]","type":0,"replies":[{ "userName":"Admin", "message":"reply text", "repliedOn":"2017-03-16T18:19:14" },{ "userName":"Commentator", "message":"reply2 text", "repliedOn":"2017-03-16T18:19:14" }]}] 

其餘示例(cURL)

curl -v "https://api.groupdocs.cloud/v1/annotation/Annotated.pdf/annotations" \
-X PUT \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "[{"creatorName":"Anonym A.","box":{ "x":173.0, "y":154.89, "width":142.5, "height":9.0 },"pageNumber":0,"annotationPosition":{ "x":173.0, "y":154.88999938964844 },"svgPath":"[{'x':173.2986,'y':687.5769},'x':315.7985,'y':687.5769},{'x':173.2986,'y':678.5769},{'x':315.7985,'y':678.5769}]","type":0,"replies":[{ "userName":"Admin", "message":"reply text", "repliedOn":"2017-03-16T18:19:14" },{ "userName":"Commentator", "message":"reply2 text", "repliedOn":"2017-03-16T18:19:14" }]}]" \
-H "authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” 

.NET SDK 示例

//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
var configuration = new Configuration
{
    AppSid = Sid,
    AppKey = Key
};

var apiInstance = new AnnotationApi(configuration);

try
{
    List annotations = new List();
    AnnotationInfo annotation = new AnnotationInfo
    {
        AnnotationPosition = new Point(852, 154.31),
        Replies = new[]
        {
                      new AnnotationReplyInfo {Message = "reply text", RepliedOn = DateTime.Now, UserName = "Admin"},
                      new AnnotationReplyInfo
                      {
                          Message = "reply2 text",
                          RepliedOn = DateTime.Now,
                          UserName = "Commentator"
                      }
                  },
        Box = new Rectangle((float)173.29, (float)154.31, (float)142.5, 9),
        PageNumber = 0,
        SvgPath =
            "[{\"x\":173.2986,\"y\":687.5769},{\"x\":315.7985,\"y\":687.5769},{\"x\":173.2986,\"y\":678.5769},{\"x\":315.7985,\"y\":678.5769}]",
        Type = AnnotationType.Text,
        CreatorName = "Anonym A."
    };
    annotations.Add(annotation);
    PutExportRequest request = new PutExportRequest()
    {
        Name ="Annotated.pdf",
        Folder=null,
        Password=null,
        Body=annotations,
        
    };
    // Insert/Export annotations to document.
    var response = apiInstance.PutExport(request);
    Debug.Print("Document Processsed and stream length: " + response.Length);

}
catch (Exception e)
{
    Debug.Print("Exception when inserting Annotation to document: " + e.Message);
} 

API瀏覽器

適用於 Cloud REST API 的 GroupDocs 還附帶一個基於 Web 的 API Explorer。這是立即在瀏覽器中試用我們的 API 的最簡單方法。它是 GroupDocs Cloud API 的 Swagger 文檔集合。簡而言之,首先您需要使用 GroupDocs Cloud 註冊獲取 APP 密鑰和 SID 並開始在您最喜歡的瀏覽器中以交互方式測試 GropuDocs.Annotation Cloud Rest API

GroupDocs.批註雲資源

以下是完成任務可能需要的一些有用資源的鏈接。

立即開始免費試用

立即開始免費試用 – 您只需註冊 GroupDocs 雲服務。註冊後,您就可以嘗試 GroupDocs Cloud 提供的強大文件處理功能。