HTML
JPG
PDF
XML
DOCX
PDF
如何使用 Cloud Go SDK 从 PDF 文档获取页面注释
为了从 PDF 文档获取页面注释,我们将使用 Aspose.PDF Cloud Go SDK 此 Cloud SDK SDK 帮助 Go 程序员使用 Go 编程语言通过 Aspose.PDF REST API 开发基于云的 PDF 创建、注释、编辑和转换应用程序。请使用包管理器控制台中的以下命令。
包管理器控制台命令
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25
使用 Go 获取页面注释的步骤
Aspose.PDF Cloud Go 开发人员可以轻松获取 PDF 文档的注释。开发人员只需几行代码。
- 将文件上传到云存储。
- 使用 GetPageAnnotations() 从页面检索注释。
- 搜索文本注释。
- 如果未找到匹配项,则返回空结果。
此示例代码展示了如何使用 PDF Cloud Go SDK 从 PDF 文档获取页面注释
package main
import (
"fmt"
asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
)
func RequestAnnotations(pdf_api *asposepdfcloud.PdfApiService, document_name string, page_num int32, remote_folder string) string {
// Get annotations from the page in the PDF document.
UploadFile(pdf_api, document_name)
args := map[string]interface{}{
"folder": remote_folder,
}
annotation_result := ""
result, httpResponse, err := pdf_api.GetPageAnnotations(document_name, page_num, args)
if err != nil {
fmt.Println(err.Error())
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
fmt.Println("RequestAnnotations(): Failed to delete annotation from the document page.")
} else {
for _, annotation := range result.Annotations.List {
if annotation.AnnotationType == asposepdfcloud.AnnotationTypeText {
fmt.Println("RequestAnnotations(): annotation id=", annotation.Id, " with '"+annotation.Contents+"' content get from the document '"+document_name+"' on ", annotation.PageIndex, " page.")
annotation_result := annotation.Id
return annotation_result
}
}
}
fmt.Println("RequestAnnotations(): Failed to get annotation in the document.")
return annotation_result
}
使用我们的 Go SDK 您可以
- 以文本或图像格式添加 PDF 文档的页眉和页脚。
- 向 PDF 文档添加表格和文本或图像水印。
- 将多个 PDF 文档附加到现有文件。
- 使用 PDF 附件、注释和表单字段。
- 对 PDF 文档应用加密或解密并设置密码。
- 从页面或整个 PDF 文档中删除所有水印和表格。
- 根据 ID 从 PDF 文档中删除特定的水印或表格。
- 替换 PDF 页面或整个文档中单个或多个实例的文本。
- 支持将 PDF 文档转换为各种其他文件格式。
- 提取 PDF 文件的各种元素并优化 PDF 文档。
- 您可以尝试我们的免费应用在线获取 PDF 文件的注释并测试其功能。