How to change the properties of an annotation?

Hi 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. This is a class that extends PdfDictionary.

To lock the annotation defined by this annotation dictionary, you need to set the PdfAnnotation.FLAGS_LOCKED flag, for instance with the setFlags() method:


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(, 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.

Ready to use iText?

Try our iText 7 Library and add-ons FREE for 30 days. Test your proof of concept, and see if our solution is right for you.

Get my FREE trial

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now