0

I am using PSPDFKit to add annotations to PDF on iOS. The problem is that the created annotation can still be modified/deleted by another app (e.g. Preview) after the file has been saved, even after I did the following before saving.

annotation.editable = NO;
annotation.flags |= (PSPDFAnnotationFlagReadOnly | PSPDFAnnotationFlagLocked | PSPDFAnnotationFlagLockedContents);

Is there a way to "lock" the annotation onto PDF so that it is not writable (or at least not easily writable) by other software?

Ying Xiong
  • 4,578
  • 8
  • 33
  • 69
  • The lock flags are included in the PDF file. It depends on the viewer whether it respects these flags or not. If Preview (or other viewer) does not respect them, there is nothing you can do. – iPDFdev Jul 07 '16 at 06:49
  • Thanks for the response, @iPDFdev. Is there a way to verify the correct flags have been written to the file? Because currently any viewer can modify the annotation, so I think the flags are not correctly written. I can find the annotation with my text editor: `/Type/Annot/Subtype/FreeText/F 708/Rect [217.668 384.560 377.332 457.440]/CA ......` any idea how to check the flag? Thanks! – Ying Xiong Jul 07 '16 at 14:17
  • 1
    Download the PDF specification here: http://www.adobe.com/devnet/pdf/pdf_reference.html (link at the end of the page) and look at the section 12.5.3 Annotation Flags. The flags are stored in the /F key. Your /F value is 708 which means: Print, Read Only, Locked, Locked Contents. – iPDFdev Jul 08 '16 at 13:21

0 Answers0