Annotations

  • PSPDFAnnotationStateManager holds the current annotation state and configures the associated PSPDFViewController to accept input related to the currently selected annotation state. The class also provides several convenience methods and user interface components required for annotation creation and configuration.

    Interested parties can use KVO to observe the manager’s properties.

    You should never use more than one PSPDFAnnotationStateManager for any given PSPDFViewController. It’s recommended to use -[PSPDFViewController annotationStateManager] instead of creating your own one in order to make sure this requirement is always met.

    PSPDFAnnotationStateManager is internally used by PSPDFAnnotationToolbar and can be re-used for any custom annotation related user interfaces.

    Note

    Do not create this class yourself. Use the existing class that is exposed in the PSPDFViewController.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFAnnotationStateManager : NSObject <PSPDFOverridable>

    Swift

    class PSPDFAnnotationStateManager : NSObject, PSPDFOverridable
  • Conforming to this protocol indicates instances can present an annotation and react events such as page show/hide (to pause video, for example)

    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationViewProtocol <NSObject>

    Swift

    protocol PSPDFAnnotationViewProtocol : NSObjectProtocol
  • Draws a circle shape representing the user touch during erasing.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFEraseOverlay : UIView

    Swift

    class PSPDFEraseOverlay : UIView
  • Toolbar for Next|Previous controls for Form Elements.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFFormInputAccessoryView : UIView

    Swift

    class PSPDFFormInputAccessoryView : UIView
  • Captures touches and shows selection boxes during dragging. Shows the selection box during dragging when using the highlight or annotation selection tool. (The rectange between the start location of dragging and the current touch location.) With the highlight tool, this also shows the proposed text to be highlighted. With the annotation selection tool, this also shows the proposed selected annotations. The selection color is determined by the tintColor property inherited from UIView. This is also used for text block debugging.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFSelectionView : UIView

    Swift

    class PSPDFSelectionView : UIView
  • A cell that centers its image.

    Declaration

    Objective-C

    
    @interface PSPDFSignatureCell : UITableViewCell

    Swift

    class PSPDFSignatureCell : UITableViewCell
  • Allows to securely store ink signatures (as ink annotations) in the keychain. Supports NSSecureCoding since this is part of the PSPDFConfiguration object.

    See more

    Declaration

    Objective-C

    @protocol PSPDFSignatureStore <NSObject, NSSecureCoding>

    Swift

    protocol PSPDFSignatureStore : NSObjectProtocol, NSSecureCoding
  • PSPDFAnnotation is the base class for all PDF annotations and forms.

    Don’t directly make an instance of this class, use subclasses like PSPDFNoteAnnotation or PSPDFLinkAnnotation. This class will return nil if initialized directly, unless with the type PSPDFAnnotationTypeUndefined.

    PSPDFAnnotationManager searches the runtime for subclasses of PSPDFAnnotation and builds up a dictionary using supportedTypes.

    Note

    Thread safety: Annotation objects should only ever be edited on the main thread. Modify properties on the main thread only if they are already active (for creation, it doesn’t matter which thread creates them). Before rendering, obtain a copy of the annotation to ensure it’s not mutated while properties are read. Once the documentProvider is set, modifying properties on a background thread will throw an exception.

    Annotations contain internal state once they are attached to a document. Don’t take them and add them to another document. Instead, create a new annotation and set the properties relevant for you, and add this annotation.

    Warning

    Annotations are mutable objects. Do not store them into NSSet or other objects that require a hash-value that does not change.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFAnnotation
        : PSPDFModel <PSPDFUndoProtocol, PSPDFJSONSerializing>

    Swift

    class PSPDFAnnotation : PSPDFModel, PSPDFUndoProtocol, PSPDFJSONSerializing
  • With the annotation provider, you can mix in PDF annotations from any source (custom database, web, etc) Implement your custom provider class and register it in the PSPDFAnnotationManager.

    (Make sure to register the provider in the PSPDFDocument’s didCreateDocumentProvider: method, since a PSPDFDocument can have multiple PSPDFDocumentProviders and thus multiple PSPDFAnnotationProviders - and they can also be discarded on low memory situations.)

    Ensure everything is thread safe here - methods will be called from any threads and sometimes even concurrently at the same time. (If you’re doing parsing, block and then in the queue re-check so you’re not parsing multiple times for the same page)

    Note

    You should always use PSPDFContainerAnnotationProvider as the base class for your custom annotation provider.
    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationProvider <NSObject>

    Swift

    protocol PSPDFAnnotationProvider : NSObjectProtocol
  • An annotation set allows to add and position multiple annotations.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFAnnotationSet : PSPDFModel <NSFastEnumeration>

    Swift

    class PSPDFAnnotationSet : PSPDFModel, NSFastEnumeration
  • The style manager will save UI-specific properties for annotations and apply them after creation. It also offers a selection of user-defined styles. There are three categories: Last used, key-specific and generic styles.

    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationStyleManager

    Swift

    protocol PSPDFAnnotationStyleManager
  • Generates an annotation summary.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFAnnotationSummarizer : NSObject

    Swift

    class PSPDFAnnotationSummarizer : NSObject
  • A caret annotation (PDF 1.5) is a visual symbol that indicates the presence of text edits, and share much similarity with note (text) annotations.

    Declaration

    Objective-C

    
    @interface PSPDFCaretAnnotation : PSPDFAnnotation

    Swift

    class PSPDFCaretAnnotation : PSPDFAnnotation
  • PDF FreeText Annotation.

    A free text annotation (PDF 1.3) displays text directly on the page. Unlike an ordinary text annotation (see 12.5.6.4, “Text Annotations”), a free text annotation has no open or closed state; instead of being displayed in a pop-up window, the text shall be always visible.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFFreeTextAnnotation : PSPDFAnnotation

    Swift

    class PSPDFFreeTextAnnotation : PSPDFAnnotation
  • The PSPDFLinkAnnotation represents both classic PDF page/document/web links, and more types not supported by other PDF readers (video, audio, image, etc)

    PSPDFKit will automatically figure out the type for PDF link annotations loaded from a document, based on the file type. (mp4 belongs to PSPDFLinkAnnotationVideo; a YouTube-URL to PSPDFLinkAnnotationYouTube, etc)

    If you create a PSPDFLinkAnnotation at runtime, be sure to set the correct type and use the URL parameter for your link. boundingBox defines the frame, in PDF space coordinates.

    If you want to customize how links look in the PDF, customize PSPDFLinkAnnotationView’s properties. There’s currently no mapping between color/lineWidth/etc and the properties of the view. This might change in a future release.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFLinkAnnotation : PSPDFAnnotation

    Swift

    class PSPDFLinkAnnotation : PSPDFAnnotation
  • PDF Note (Text) Annotation. - note: Note annotations are rendered as fixed size; much like how Adobe Acrobat renders them. PSPDFKit will always render note annotations at a fixed size of 32x32pt. We recommend that you set the boundingBox to the same value.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFNoteAnnotation : PSPDFAnnotation

    Swift

    class PSPDFNoteAnnotation : PSPDFAnnotation
  • Polyline annotations (PDF 1.5) are similar to polygons (PSPDFPolygonAnnotation), except that the first and last vertex are not implicitly connected. - note: SeePSPDFAbstractLineAnnotation` for details how to use and initialize.

    Declaration

    Objective-C

    
    @interface PSPDFPolyLineAnnotation : PSPDFAbstractLineAnnotation

    Swift

    class PSPDFPolyLineAnnotation : PSPDFAbstractLineAnnotation
  • RichMedia annotations are defined in the ISO32000 Adobe Supplement and are the modern way of embedding video content. PSPDFKit also supports the matching RichMediaExecute action to control video state.

    Declaration

    Objective-C

    
    @interface PSPDFRichMediaAnnotation : PSPDFAssetAnnotation

    Swift

    class PSPDFRichMediaAnnotation : PSPDFAssetAnnotation
  • A screen annotation (PDF 1.5) specifies a region of a page upon which media clips may be played. It also serves as an object from which actions can be triggered. PSPDFKit also supports the matching Rendition Actions to control the video play state. - note: iOS cannot play all video/audio formats that can be used for PDF.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFScreenAnnotation : PSPDFAssetAnnotation

    Swift

    class PSPDFScreenAnnotation : PSPDFAssetAnnotation
  • A sound annotation (PDF 1.2) shall analogous to a text annotation except that instead of a text note, it contains sound recorded from the iOS device’s microphone or imported from a file.

    To ensure maximum compatibility set the boundingBox for sound annotations to the same size Adobe Acrobat uses (20x15pt). PSPDFKit will always render sound annotations at a fixed size of 74x44pt, centered in the provided boundingBox.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFSoundAnnotation : PSPDFAnnotation

    Swift

    class PSPDFSoundAnnotation : PSPDFAnnotation