HTML JPG PDF XML DOCX
  Product Family
PDF

Delete text annotations from PDF documents via .NET SDK

API for removing text annotations from PDF documents with Aspose.PDF Cloud .NET SDK.

Get Started

How to delete text annotations from PDF documents using Cloud .NET SDK

For removing text annotations from PDF documents, we’ll use Aspose.PDF Cloud .NET SDK This Cloud SDK allows you to easily build cloud-based PDF creator, editor & converter apps in C#, ASP.NET, or other .NET languages for various cloud platforms. Open NuGet package manager, search for Aspose.PDF Cloud and install. You may also use the following command from the Package Manager Console.

Package Manager Console Command


    PM> Install-Package Aspose.Pdf-Cloud
     

Steps to remove annotations using .NET SDK

Aspose.PDF Cloud developers can easily load & delete annotations to PDF documents in just a few lines of code.

  1. Uploads the document to the cloud.
  2. Deletes a specific annotation using DeleteTextAnnotation().
  3. Handles the response to ensure success.
  4. Removes any related popup annotations.
  5. Downloads the updated document.
 

This sample code shows removing Text Annotations from PDF document via C#


    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_");
                }
            }
        }
    }