PDF Annotation

Remove comments from PDF documents with free cross-platform Apps and APIs

How to Annotate PDF files Using Aspose.PDF Library

Annotation is an important part of a PDF file. Aspose.PDF, a developer-friendly .NET PDF component, can meet your annotation needs. Using Aspose.PDF, you can add a new annotation, edit an existing annotation, remove an annotation, etc. In order to annotate PDF file, we’ll use Aspose.PDF API which is a feature-rich, powerful and easy to use document manipulation API. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.

High Code APIs to Edit Comments & Notes in Document

Native APIs to annotate PDF files using .NET, .NET Core, Java, C++ & Android. These are additional objects that you add to your file to expand the content of the text, make edits, comments for other users. It is also possible to make the text in the document more readable, highlight it, underline it or add completely new text.

Add Caret Annotations to PDF via C#

Annotate PDF Document with Caret Annotation Using C# with Aspose.PDF for .NET Library.

Add Caret Annotations - C#

// Load the PDF file
Document document = new Document(System.IO.Path.Combine(_dataDir, "sample.pdf"));
// This annotation is used to indicate the insertion of text
var caretAnnotation1 = new CaretAnnotation(document.Pages[1],
    new Rectangle(299.988, 713.664, 308.708, 720.769))
{
    Title = "Aspose User",
    Subject = "Inserted text 1",
    Flags = AnnotationFlags.Print,
    Color = Color.Blue
};
document.Pages[1].Annotations.Add(caretAnnotation1);
document.Save(System.IO.Path.Combine(_dataDir, "sample_caret.pdf"));

Add Circle Annotations to PDF via Java

Annotate PDF Document with Circle Annotation Using Java with Aspose.PDF for Java Library.

Add Circle Annotations - Java

// Load the PDF file
Document document = new com.aspose.pdf.Document(_dataDir + "appartments.pdf");
Page page = document.getPages().get_Item(1);

// Create Polygon Annotation
CircleAnnotation circleAnnotation = new CircleAnnotation(page, new Rectangle(270, 160, 483, 383));
circleAnnotation.setTitle("John Smith");
circleAnnotation.setColor(Color.getRed());
circleAnnotation.setInteriorColor(Color.getMistyRose());
circleAnnotation.setOpacity(0.5);
circleAnnotation.setPopup(new PopupAnnotation(page, new Rectangle(842, 316, 1021, 459)));

// Add annotation to the page
page.getAnnotations().add(circleAnnotation);
document.save(_dataDir + "appartments_mod.pdf");

Add FreeText Annotations to PDF via C++

Annotate PDF Document with FreeText Annotation Using C++ with Aspose.PDF for С++ Library.

Add FreeText Annotations - C++

String _dataDir("C:\\Samples\\");

// Load the PDF file
auto document = MakeObject<Document>(_dataDir + u"sample.pdf");
auto page = document->get_Pages()->idx_get(1);

auto defaultAppearance = MakeObject<DefaultAppearance>();
defaultAppearance->set_FontName(u"Helvetica");
defaultAppearance->set_FontSize(12);
defaultAppearance->set_TextColor(System::Drawing::Color::get_Blue());

auto freeTextAnnotation = MakeObject<FreeTextAnnotation>(page, new Rectangle(300.0, 770.0, 400.0, 790.0), defaultAppearance);

freeTextAnnotation->set_RichText(u"Free Text Demo");
page->get_Annotations()->Add(freeTextAnnotation);
document->Save(_dataDir + u"sample_freetext.pdf");