Insert Comment in PDF using C# REST API

This article guides on how to insert comment in PDF using C# REST API. You will learn how to add comment in PDF file using C# Low Code API in the form of Text Annotation by setting desired parameters. By following this article, you will add comments along with an icon on any page of the PDF file that the user can view by clicking on this icon.

Prerequisite

Steps for Adding Comments on PDF using C# REST API

  1. Start by adding the Aspose PDF Cloud SDK, along with basic .NET libraries for file and data handling
  2. Set up the PdfApi using your credentials so the application can communicate with the cloud service
  3. Decide which PDF you’re working with and which page should receive the comment
  4. Send the local PDF file to Aspose Cloud storage so it’s ready for processing
  5. Define a text annotation with its position, message, author name, and visual appearance
  6. Place the annotation into a collection since the API works with lists of annotations
  7. Call the API to apply the text annotation to the selected page in the PDF
  8. Check and display the response status to make sure the annotation was added successfully
  9. Retrieve the annotated PDF from the cloud and save it locally as the final file

These steps explain how to add comments on a PDF document using C# REST Interface. Upload the PDF to Aspose PDF Cloud, choose the page you want to comment on, and create a sticky-note style annotation with your message and appearance settings. Apply the annotation, confirm it was added successfully, and download the updated PDF to your local machine.

Code to Add Comment to PDF File using C# REST Interface

This sample code demonstrates how to insert a comment in PDF using C# RESTful Service. The Rect argument in the TextAnnotation object defines the location of the comments from the bottom-left corner of the PDF page. The pageNumber property in the PostPageTextAnnotations() method defines the page number of the uploaded PDF file.

This article has taught us the process to add comments to a PDF file. To compare two PDF files in the Cloud, refer to the article Compare PDF Files using C# REST API.