Insert Comment in PDF using Node.js REST API

This guide shows how to Node.js REST API developers can easily insert a comment in a PDF file using Aspose PDF Cloud, letting you add sticky‑note style annotations with custom text, author, and icon that appear when users click the annotation marker. For more details about the PDF format, see the PDF file info page.

Prerequisite

Steps for Adding Comments on PDF using Node.js REST API

  1. Start by adding the Aspose PDF Cloud SDK, along with basic Node.js 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 the Node.js 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 Node.js REST Interface

This sample code demonstrates how to insert a comment in PDF using Node.js RESTful Service. The Rect argument in the TextAnnotation object defines the location of the comment 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.

To compare two PDF files in the Cloud, refer to the article Compare PDF Files using Node.js REST API.

Keywords: how to add comment in pdf file using Node.js Low Code API; how to add comments on a pdf document using Node.js REST Interface; insert comment in pdf using Node.js REST API.