Set Appearance stream for PDF Annotation

The PDFAnnotation class provides a method to return if the specific class has an appearance stream:


- hasAppearanceStream

Returns a Boolean value that indicates whether the annotation has an appearance stream associated with it.


However, I could not find any method to provide that AppearanceStream. I would like to derive my own class from PDFAnnotation and provide my own PDF apperance stream for it.


Any helpful pointers or ideas?

Thanks a million


Klaus

Replies

Old thread, I know, but I'm surprised there are no replies.


PDFAnnotation has an initializer that takes a dictionary, and there are keys listed in the header:


extern NSString* const kPDFAnnotationKey_AppearanceDictionary;              // "/AP": Dictionary
extern NSString* const kPDFAnnotationKey_AppearanceState;                   // "/AS": Name


I assume this is how you set the appearance stream, although I haven't tried it, and I don't know what format it would need to be in. The only hit on Google for those symbols is the Apple documentation.


Has anyone used this?

With iOS 13.2 hasAppearanceStream is true for my annotation, but when I try to get the values for appearanceDictionary and appearanceState both return nil. Neither of these appear in annotationKeyValues either.


I want to copy the appearance stream from one annotation to another, but don't know how to retrieve it.