We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

How to Add Annotations to a PDF in C# using Aspose.PDF REST API?


I had a question regarding your Cloud API - we’re running a .NET stack and were looking into Aspose.pdf for Cloud but could not find any documentation regarding setting (not getting) annotations. If this feature available?

If not, is the .NET standalone version capable of doing so? I found examples for the Android version but wanted to ask here first.



Thank you for contacting support. I’m sorry to share with you that currently using Cloud API you can only retrieve existing annotations from PDF file. Please refer to the following documentation link:

You cannot add/create another annotation with Cloud API. It is not supported. I have logged this feature request under ticket id SAASPDF-109 in our issue tracking system. Your feature request has also been linked to this issue and you will be notified as soon as it is supported. We’re sorry for your inconvenience.

Second, It would be great if you can elaborate a bit more about the specific requirement. It will help us to cater exact feature support.

Well, using .NET standalone version, You can add, delete or set formatting of an annotation. Please refer to helping articles here: http://www.aspose.com/docs/display/pdfnet/Working+with+Annotations

Please do let us know in case of any confusion or questions.


We have implemented the feature in Aspose.PDF Cloud API to add annotations to PDF documents. Now, Aspose.PDF Cloud API supports several Annotation types, some of them are Strikeout Annotations, Highlight Annotations, Line Annotations, Circle Annotations, Polyline Annotations, Square Annotations, Squiggly Annotations, Text Annotations and Redaction Annotations.

Please check the following C# example to add comments to PDF document using free text Annotation. You may check the documentation for more details.

Working with Annotation in Aspose.PDF Cloud

Steps to Add Comments to PDF in C#

  1. Create a new Project in Visual Studio and install Aspose.PDF Cloud NuGet package
  2. Add Aspose.PDF Cloud API reference to the project
  3. Initialize the Aspose.PDF Cloud API
  4. Upload input document to Cloud storage
  5. Initialize the FreeTextAnnotation object and set the required properties
  6. Add comments to PDF page using PostPageFreeTextAnnotations request
  7. Download and Save the output PDF document to your local drive

Code to Add Comments to PDF in C#

using Aspose.Pdf.Cloud.Sdk.Api;
using Aspose.Pdf.Cloud.Sdk.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestConsoleApp
    class Program
        static void Main(string[] args)
            String fileName = "02_pages.pdf";
            String remoteFolder = "Temp";
            // Initialzie Aspose.PDF Cloud API
            // Get Cilent ID and Client Secret from https://dashboard.aspose.cloud/
            PdfApi pdfApi = new PdfApi(MyAppKey, MyAppSid);
            // Upload source PDF file to aspose cloud storage
            pdfApi.UploadFile(remoteFolder + "/" + fileName, System.IO.File.OpenRead("C:/Temp/02_pages.pdf"));

            // Add Free Text Annotation to uploaded PDF file
            List<FreeTextAnnotation> annotations = new List<FreeTextAnnotation>
                new FreeTextAnnotation(Rect: new Aspose.Pdf.Cloud.Sdk.Model.Rectangle(100, 600, 200, 700),
                    TextStyle: new TextStyle(FontSize: 12, Font: "Arial", ForegroundColor: new Aspose.Pdf.Cloud.Sdk.Model.Color(0xFF, 0, 0xFF, 0), BackgroundColor: new Aspose.Pdf.Cloud.Sdk.Model.Color(0xFF, 0xFF, 0, 0)))
                    Name = "Test Free Text",
                    Flags = new List<AnnotationFlags> { AnnotationFlags.Default},
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Intent = FreeTextIntent.FreeTextTypeWriter,
                    RichText = "Aspose.PDF Cloud API",
                    Subject = "Text Box Subj",
                    ZIndex = 1,
                    Justification = Justification.Center,
                    Title = "Title"

            var response = pdfApi.PostPageFreeTextAnnotations(fileName, 1, annotations, folder: remoteFolder);
            // Download file Cloud storage
            var downloadResponse = pdfApi.DownloadFile(remoteFolder + "/" + fileName);
            var fileStream = System.IO.File.Create("C:/Temp/FreeTextAnnotation.pdf");