HTML
JPG
PDF
XML
DOCX
PDF
如何使用 Cloud .NET SDK 删除 PDF 文档中的页面注释
为了从 PDF 文档中删除页面注释,我们将使用 Aspose.PDF Cloud .NET SDK 该 Cloud SDK 允许您轻松在 C#、ASP.NET 或其他 .NET 语言中构建基于云的 PDF 创建、编辑和转换应用程序,适用于各种云平台。打开 NuGet 包管理器,搜索 Aspose.PDF Cloud 并安装。您也可以使用以下命令从包管理器控制台进行安装。
包管理器控制台命令
PM> Install-Package Aspose.Pdf-Cloud
使用 .NET SDK 删除注释的步骤
Aspose.PDF Cloud 开发人员可以轻松地加载和删除 PDF 文档中的注释,只需几行代码。
- 上传输入 PDF。
- 从指定页面删除所有注释。
- 处理错误并报告状态。
- 下载清理后的 PDF 文件。
此示例代码展示如何通过 C# 从 PDF 文档中删除页面注释
using Aspose.Pdf.Cloud.Sdk.Model;
namespace Annotations
{
public class DeletePageAnnotations
{
public async static Task MakeDeleteAsync(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder)
{
// Delete annotation from the PDF document.
await helper.UploadFile(documentName);
AsposeResponse response = await helper.pdfApi.DeletePageAnnotationsAsync(documentName, pageNumber, folder: remoteFolder);
if (response == null)
Console.WriteLine("DeletePageAnnotations(): Unexpected error!");
else if (response.Code < 200 || response.Code > 299)
Console.WriteLine("DeletePageAnnotations(): Failed to delete annotation from the document.");
else {
Console.WriteLine("DeletePageAnnotations(): annotations on page '{0}' deleted from the document '{1}.", pageNumber, documentName);
await helper.DownloadFile(documentName, outputName, "del_page_annotations_");
}
}
}
}