HTML
JPG
PDF
XML
DOCX
PDF
如何使用 Cloud .NET SDK 从 PDF 文档中删除文本注释
为了从 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 删除注释的步骤
Aspose.PDF Cloud 开发者可以通过几行代码轻松加载和删除 PDF 文档中的注释。
- 上传文档到云。
- 使用 DeleteTextAnnotation() 删除特定注释。
- 处理响应以确保成功。
- 移除任何相关的弹出注释。
- 下载更新后的文档。
此示例代码展示了如何通过 C# 从 PDF 文档中删除文本注释
using Aspose.Pdf.Cloud.Sdk.Model;
namespace Annotations
{
public class DeleteTextAnnotation
{
public async static Task MakeDeleteAsync(AnnotationsHelper helper, string documentName, string annotationId, string outputName, string remoteFolder)
{
// Delete annotation from the PDF document.
await helper.UploadFile(documentName);
AsposeResponse response = await helper.pdfApi.DeleteAnnotationAsync(documentName, annotationId, folder: remoteFolder);
if (response == null)
Console.WriteLine("DeleteTextAnnotation(): Unexpected error!");
else if (response.Code < 200 || response.Code > 299)
Console.WriteLine("DeleteTextAnnotation(): Failed to delete annotation from the document.");
else
{
await helper.DeletePopupAnnotationsAsync(documentName, annotationId, remoteFolder);
Console.WriteLine("DeleteTextAnnotation(): annotations '{0}' deleted from the document '{1}.", annotationId, documentName);
await helper.DownloadFile(documentName, outputName, "del_text_annotations_");
}
}
}
}