HTML
JPG
PDF
XML
DOCX
PDF
如何使用 Cloud .NET SDK 解析 PDF 文档以提取表单字段为 FDF
要使用 Cloud .NET SDK 解析 PDF 文档以提取表单字段为 FDF,我们将使用 Aspose.PDF Cloud .NET SDK 这个 Cloud .NET SDK 允许您轻松地在 C#、ASP.NET 或其他 .NET 语言中构建基于云的 PDF 创建、编辑和转换应用程序,适用于各种云平台。打开 NuGet 包管理器,搜索 Aspose.PDF Cloud 并安装。您也可以使用以下命令从包管理器控制台安装。
包管理器控制台命令
PM> Install-Package Aspose.Pdf-Cloud
使用 .NET SDK 解析 PDF 以提取表单字段为 FDF 的步骤
Aspose.PDF Cloud 开发人员可以轻松解析 PDF 文档以提取表单字段为 FDF。开发人员只需几行代码。
- 使用您的应用程序密钥和密钥创建一个新的配置对象
- 创建一个对象以连接到 Cloud API
- 上传您的文档文件
- 使用 PutExportFieldsFromPdfToFdfInStorageAsync 函数在云存储中解析 PDF 文档以提取表单字段为 FDF
- 检查响应并记录结果
- 如有需要,下载 FDF 文件到本地
此示例代码展示了如何解析 PDF 文档以提取表单字段为 FDF
using Aspose.Pdf.Cloud.Sdk.Model;
namespace Parser
{
public class ExportFormToFDF
{
public static async Task Extract(string documentName, string outputFdfName, string remoteFolder)
{
// Get your AppSid and AppSecret from https://dashboard.aspose.cloud (free registration required).
pdfApi = new PdfApi(AppSecret, AppSid);
using (var file = File.OpenRead(Path.Combine(localFolder, documentName)))
{ // Upload the local PDF to cloud storage folder name.
FilesUploadResult uploadResponse = await pdfApi.UploadFileAsync(Path.Combine(remoteFolder, documentName), documentName);
Console.WriteLine(uploadResponse.Uploaded[0]);
}
string fdfPath = Path.Combine(remoteFolder, outputFdfName);
// Parse PDF to extract Form fields as FDF in cloud storage.
AsposeResponse response = await pdfApi.PutExportFieldsFromPdfToFdfInStorageAsync(documentName, fdfPath, folder: remoteFolder);
// Checks the response and logs the result.
if (response == null)
Console.WriteLine("ExportFormToFDF(): Unexpected error!");
else if (response.Code < 200 || response.Code > 299)
Console.WriteLine("ExportFormToFDF(): Failed to export Pdf document form fields.");
else
{ // Downloads the updated file for local use.
Console.WriteLine("ExportFormToFDF(): Pdf document '{0}' form fields successfully exported to '{1} file.", documentName, outputFdfName);
Stream stream = pdfApi.DownloadFile(Path.Combine(remoteFolder, outputFdfName));
using var fileStream = File.Create(Path.Combine(localFolder, outputFdfName));
stream.Position = 0;
await stream.CopyToAsync(fileStream);
Console.WriteLine("ExportFormToFDF(): File '{0}' successfully downloaded.", outputFdfName);
}
}
}
}
通过 .NET SDK 处理 PDF 中的表单解析
通过解析 PDF 文档以提取表单字段为 FDF,可以系统地验证每个表单字段的有效性和相关性,确保所有引用都是最新和有效的。对于下载表单字段为 FDF 或进行批量分析等任务,提取表单字段可以实现自动化,节省时间并减少人工工作。 使用 Aspose.PDF Cloud .NET SDK 解析 PDF 文档以提取表单字段为 FDF。
使用我们的 .NET SDK,您可以
- 添加 PDF 文档的文本或图像格式的页眉和页脚。
- 向 PDF 文档添加表格和文本或图像水印。
- 将多个 PDF 文档附加到现有文件中。
- 处理 PDF 附件、注释和表单字段。
- 对 PDF 文档应用加密或解密并设置密码。
- 删除页面或整个 PDF 文档中的所有水印和表格。
- 根据 ID 删除 PDF 文档中的特定水印或表格。
- 替换 PDF 页面或整个文档中的单个或多个文本实例。
- 广泛支持将 PDF 文档转换为各种其他文件格式。
- 提取 PDF 文件的各种元素并优化 PDF 文档。
- 您可以尝试我们的免费应用来测试功能。