HTML JPG PDF XML DOCX
  Product Family
PDF

Lấy Chú Thích Trang từ PDF qua .NET SDK

API để lấy chú thích từ tài liệu PDF với Aspose.PDF Cloud .NET SDK.

Get Started

Cách lấy chú thích trang từ tài liệu PDF sử dụng Cloud .NET SDK

Để lấy chú thích trang từ tài liệu PDF, chúng ta sẽ sử dụng Aspose.PDF Cloud .NET SDK Cloud SDK này cho phép bạn dễ dàng xây dựng ứng dụng tạo, chỉnh sửa & chuyển đổi PDF dựa trên đám mây bằng C#, ASP.NET, hoặc các ngôn ngữ .NET khác cho nhiều nền tảng đám mây. Mở NuGet trình quản lý gói, tìm kiếm Aspose.PDF Cloud và cài đặt. Bạn cũng có thể sử dụng lệnh sau từ Bảng Điều Khiển Trình Quản Lý Gói.

Lệnh Bảng Điều Khiển Trình Quản Lý Gói


    PM> Install-Package Aspose.Pdf-Cloud
     

Các bước để lấy chú thích sử dụng .NET SDK

Các nhà phát triển Aspose.PDF Cloud có thể dễ dàng tải & lấy chú thích từ tài liệu PDF chỉ với vài dòng mã.

  1. Tải lên một tài liệu.
  2. Lấy tất cả chú thích từ một trang được chỉ định.
  3. Ghi lại chi tiết của từng chú thích.
  4. Trả về ID của chú thích văn bản đầu tiên (cho các hành động tiếp theo như chỉnh sửa hoặc xóa).
 

Mã mẫu này hiển thị cách lấy Chú Thích Trang từ tài liệu PDF qua C#


    using Aspose.Pdf.Cloud.Sdk.Model;

    namespace Annotations
    {
        public class GetAnnotations
        {
            public static async Task<string> RequestAnnotationsOnPageAsync(AnnotationsHelper helper, string documentName, int pageNumber, string remoteFolder)
            {
                // Get annotations from the page in the PDF document.
                await helper.UploadFile(documentName);

                string annotationResult = string.Empty;
                AnnotationsInfoResponse response = await helper.pdfApi.GetPageAnnotationsAsync(documentName, pageNumber, folder: remoteFolder);

                if (response == null)
                    Console.WriteLine("RequestAnnotationsOnPageAsync(): Unexpected error!");
                else if (response.Code < 200 || response.Code > 299)
                    Console.WriteLine("RequestAnnotationsOnPageAsync(): Failed to request annotations from the document.");
                else
                {
                    foreach (AnnotationInfo annotation in response.Annotations.List)
                    {
                        Console.WriteLine("RequestAnnotationsOnPageAsync(): annotation '{0}' with '{1}' contents get from the '{2}' page of the document '{3}.", [annotation.Id, annotation.Contents, pageNumber, documentName]);
                        if (string.IsNullOrEmpty(annotationResult) &&
                            annotation.AnnotationType == AnnotationType.Text)
                        {
                            annotationResult = annotation.Id;
                        }
                    }
                }
                return annotationResult;
            }
        }
}