HTML
JPG
PDF
XML
DOCX
PDF
如何通过 Cloud .NET SDK 从 PDF 中删除表格
为了通过 Cloud .NET SDK 从 PDF 中删除表格,我们将使用 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 中删除表格的步骤
Aspose.PDF Cloud 开发人员可以轻松地在几行代码中加载和删除 PDF 中的表格。
- 使用您的应用程序密钥和密钥创建一个新的配置对象。
- 创建一个对象以连接到 Cloud API。
- 将 PDF 上传到云存储。
- 使用 DeleteDocumentTablesAsync 函数从云存储中的 PDF 中删除表格。
- 检查响应并记录结果。
- 下载更新后的文件以供本地使用。
此示例代码显示如何从 PDF 文档中删除表格
using Aspose.Pdf.Cloud.Sdk.Model;
namespace Tables
{
public class DeleteTables
{
public static async Task Remove(string documentName, string outputName, 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]);
}
// Delete tables from the PDF on cloud storage.
AsposeResponse response = await pdfApi.DeleteDocumentTablesAsync(documentName, folder: remoteFolder);
// Checks the response and logs the result.
if (response == null)
Console.WriteLine("DeleteTables(): Unexpected error!");
else if (response.Code < 200 || response.Code > 299)
Console.WriteLine("DeleteTables(): Failed to remove tables from the document.");
else
{ // Downloads the updated file for local use.
Console.WriteLine("DeleteTables(): All tables successfully removed from the document '{0}.", documentName);
Stream stream = pdfApi.DownloadFile(Path.Combine(remoteFolder, documentName));
using var fileStream = File.Create(Path.Combine(localFolder, "delete_tables_" + outputName));
stream.Position = 0;
await stream.CopyToAsync(fileStream);
Console.WriteLine("DeleteTables(): File '{0}' successfully downloaded.", "delete_tables_" + outputName);
}
}
}
}
处理 PDF 中的表格
删除文档中的表格可能是为了简化文档,当表格包含不必要的信息时,确保保密性时,当表格包含个人数据、价格、联系人或其他敏感信息时,为了重新利用,如果需要将文档作为模板进行自动处理,打印时进行优化,编辑和更新信息时如果表格已过时或包含错误。 使用 Aspose.PDF Cloud Node.js SDK 从 PDF 文档中删除表格。
使用我们的 .NET 库,您可以:
- 添加 PDF 文档的页眉和页脚(文本或图像格式)。
- 向 PDF 文档添加表格和印章(文本或图像格式)。
- 将多个 PDF 文档附加到现有文件。
- 处理 PDF 附件、注解和表单字段。
- 对 PDF 文档进行加密或解密并设置密码。
- 删除页面或整个 PDF 文档中的所有印章和表格。
- 通过其 ID 删除 PDF 文档中的特定印章或表格。
- 替换 PDF 页面或整个文档中的单个或多个文本实例。
- 对将 PDF 文档转换为多种其他文件格式提供广泛支持。
- 提取 PDF 文件的各种元素并优化 PDF 文档。
- 您可以尝试我们的 免费应用 在线将表格提取到 PDF 文件中并测试功能。