How can I prevent the editing of PDF annotations?

Skip to first unread message

Aaron Gravesdale

Nov 27, 2013, 3:44:42 PM11/27/13

I want to prevent the editing of PDF annotations.  What are my options?


One option is to disable annotation editing in the document's security settings.  PDF viewers which respect this flag will disable annotation editing if the flag is set.  See the Encryption code samples ( as an example.  Use the SecurityHandler::e_mod_annot flag.

Note that some viewers, including the PDFTron sample viewers, fail to respect this flag.  Because PDFTron gives customers the source code to its viewer samples, you are free to customize annotation editing to respect the e_mod_annot flag.

However, there is another approach to disabling annotation editing that works in all viewers -- simply merging annotations with page content. This can be done with PDFDoc.FlattenAnnotations().


Dec 2, 2013, 4:56:53 PM12/2/13
Q:  I used Preview application on Mac OS X to open some flattened PDFs and it is allowing me to fill in some form fields. I thought that PDFDoc.FlattenAnnotations() would remove all forms & annots?
Any idea what is going on?


We looked into it and can confirm that PDF files flattened with PDFNet do not contain any information related to annotations of forms. The Preview is doing some monkey business to allow this sort of text editing. We tested this Preview 'feaure' on our end and found it to be buggy and unreliable.


There is technically nothing we (or you) can do to about this….  your clients can always temper with files (e.g. apply stamps, modify static content, etc.).


If you need to make sure that the original file is not modified, the right tool for the job would be to use electronic signatures (e.g. as shown in DigitalSignatures sample: With electronic signatures any modification to the file would invalidate the signature.


In case your main motivation is to enforce greater control over content (e.g. implement a custom DRM) you may want to take a look at WebViewer (

Reply all
Reply to author
0 new messages