HTML JPG PDF XML DOCX
  Product Family
PDF

Delete annotations from PDF document pages via .NET SDK

API for removing annotations from PDF document pages with Aspose.PDF Cloud .NET SDK.

Get Started

How to delete annotations from PDF document pages using Cloud .NET SDK

For removing page 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 input PDF.
  2. Deletes all annotations from a specified page.
  3. Handles errors and reports status.
  4. Downloads the cleaned-up PDF file.
 

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


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