HTML JPG PDF XML DOCX
  Product Family
PDF

Lấy Forms PDF trong .NET SDK

Xây dựng ứng dụng Cloud của riêng bạn để lấy tập tin tài liệu có thể điền thông qua API певсокоти.

Get Started

Cách Lấy Trường Form từ Tài liệu PDF sử dụng Cloud .NET SDK

Để lấy một AcroForm thông qua Cloud .NET SDK , chúng tôi 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 cloud bằng C#, ASP.NET hoặc ngôn ngữ .NET khác cho các nền tảng cloud khác nhau. Mở NuGet 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ừ Console Quản lý gói.

Lệnh Console Quản lý gói


     
    PM> Install-Package Aspose.Pdf-Cloud
     
     

Các bước để lấy AcroForms thông qua .NET SDK

Nhung̣ năng developers có thể dễ dàng tải và lấy acroforms trong PDF chỉắm vài dòng mã.

  1. Tạo một đối tượng Configuration mới với Application Secret và Key của bạn
  2. Tạo một đối tượng để kết nối với Cloud API
  3. Tải lên file tài liệu của bạn
  4. Thực hiện việc lấy
  5. Tải xuống kết quả
 

Mã mẫu này hiển thị việc lấy AcroForms trong các tài liệu PDF


    public static void GetFormFields()
    {
        const string localImageFileName = @"C:\Samples\StudentInfoFormElectronic.pdf";
        const string storageFileName = "StudentInfoFormElectronic.pdf";

        // Get your AppSid and AppSecret from https://dashboard.aspose.cloud (free registration required).            
        var pdfApi = new PdfApi(AppSecret, AppSid);

        if (pdfApi.GetFilesList("").Value.All(f => f.Name != storageFileName))
        {
            using var file = File.OpenRead(localImageFileName);
            var uploadResult = pdfApi.UploadFile(storageFileName, file);
            Console.WriteLine(uploadResult.Uploaded[0]);
        }

        var response = pdfApi.GetFields(storageFileName);
        foreach (var item in response.Fields.List)
        {
            if (item.Type == FieldType.List)
            {
                Console.Write($"Name: [{item.Name}] Value:");
                foreach (var listItem in item.Values)
                {
                    Console.WriteLine($"{listItem} ");
                }
            }
            else
            {
                Console.WriteLine($"Name: [{item.Name}] Value: [{item.Values.FirstOrDefault()}]");
            }

        }
    }