HTML
JPG
PDF
XML
DOCX
PDF
如何通过 Cloud .NET SDK 从 PDF 中按 Id 提取表格
为了通过 Cloud .NET SDK 从 PDF 中按 Id 提取表格,我们将使用 Aspose.PDF Cloud .NET SDK 这个 Cloud SDK 允许您轻松构建基于云的 PDF 创建、编辑和转换应用程序,支持 C#、ASP.NET 或其他 .NET 语言,适用于各种云平台。打开 NuGet 包管理器,搜索 Aspose.PDF Cloud 并安装。您还可以在包管理器控制台中使用以下命令。
包管理器控制台命令
PM> Install-Package Aspose.Pdf-Cloud
通过 .NET SDK 从 PDF 中按 Id 提取表格的步骤
Aspose.PDF Cloud 开发人员可以轻松加载并在短短几行代码中从 PDF 中按 Id 获取表格。
- 使用您的应用程序秘密和密钥创建一个新的配置对象。
- 创建一个对象以连接到 Cloud API。
- 将 PDF 上传到云存储。
- 使用 GetTableAsync 函数从云存储中的 PDF 中按 Id 提取表格。
- 检查响应并记录结果。
- 如果操作成功,则打印表格属性。
该示例代码展示了如何从 PDF 文档中按 Id 提取表格
using Aspose.Pdf.Cloud.Sdk.Model;
namespace Tables
{
public class GetTable
{
public static async Task Extract(string documentName, string tableId, 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]);
}
// Get all tables from the PDF on cloud storage.
TablesRecognizedResponse response = await pdfApi.GetTableAsync(documentName, tableId, folder: remoteFolder);
// Checks the response and logs the result.
if (response == null)
Console.WriteLine("GetTable(): Unexpected error!");
else if (response.Code < 200 || response.Code > 299)
Console.WriteLine("GetTable(): Failed to extract table from the document.");
else
{ // If the operation was successful, print the table properties or make some other actions
Console.WriteLine("GetTable(): Table '{0}' successfully received from the document '{1}.", tableId, documentName);
Console.WriteLine(response.Table.ToString());
}
}
}
}
处理 PDF 中的表格
表格为系统化呈现数据提供了一种结构化的格式,使读者更容易理解和分析信息。它们还增强了文档的视觉吸引力,增添了专业性和组织性。在处理数值或比较数据时,表格通过将相关信息分组为易于阅读的格式来提高清晰度。此外,表格可以包含实时或动态生成的内容,例如来自数据库或分析仪表板的数据。 使用 Aspose.PDF Cloud Node.js SDK 从 PDF 文档中按 Id 获取表格。
使用我们的 .NET 库,您可以:
- 以文本或图像格式添加 PDF 文档的页眉和页脚。
- 向 PDF 文档添加表格和印章(文本或图像)。
- 将多个 PDF 文档追加到现有文件中。
- 处理 PDF 附件、注释和表单字段。
- 对 PDF 文档应用加密或解密并设置密码。
- 从页面或整个 PDF 文档中删除所有印章和表格。
- 按 ID 从 PDF 文档中删除特定的印章或表格。
- 替换 PDF 页面或整个文档中的单个或多个文本实例。
- 广泛支持将 PDF 文档转换为各种其他文件格式。
- 提取 PDF 文件的各种元素并优化 PDF 文档。
- 您可以尝试我们的 免费应用 在线提取表格到 PDF 文件并测试功能。