Skip to main content
Skip table of contents

How to change the properties of an annotation?


I am adding Caret annotation in already existing PDF using iTextSharp in C#.

Now I want to made some changes in the Annotation properties, such as Opacity of color and Locked.

Acrobat screen shot

Posted on StackOverflow on Oct 23, 2013 by Thirusanguraja Venkatesan

Suppose that you have a PdfAnnotation object in iText 7. To lock the annotation defined by this annotation dictionary, you need to set the PdfAnnotation.LOCKED flag, for instance with the setFlags() method:

annot.setFlags(PdfAnnotation.LOCKED);

Note that using this method will override the flags that were already defined before.

As for the opacity, that's define by the ca entry of the annotation dictionary.

annot.put(PdfName.ca, new PdfNumber(0.27));

My snippets are written in Java. You'll need to apply small changes to the methods if you want to use them in C# code.

Click How to change the properties of an annotation? if you want to see how to answer this question in iText 5.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.