PSPDFDocumentFeaturesSource

Objective-C

@protocol PSPDFDocumentFeaturesSource <NSObject>

Swift

protocol PDFDocumentFeaturesSource : NSObjectProtocol

A document feature source can disable various features if there are reasons within its controlled scope that make this feature unavailable.

You can implement your own sources by conforming to this protocol. Besides the required methods you should only implement the features that your source actually control. The result of your source will be combined with the results of the framework’s sources through a logical AND. This means if your source disallows a feature this feature is no longer available, however if your source allows a feature there might still be other sources disallowing a feature. Only if all sources allow a feature, the feature will be enabled.

Caching

The results of all features you implement will be cached. Whenever the state of a feature changes, you need to call [features updateFeatures] for changes to take effect. This is also necessary to allow notifying interested observers about the change in state.

Threading

Your custom sources have to be thread safe. They are not guaranteed to be called on any particular queue.

  • A back reference to the PSPDFDocumentFeatures instance that owns this source.

    You can use this reference when implementing you own custom sources to call updateFeatures on it whenever a feature changes its state.

    Ensure this is implemented as a weak property, otherwise you will have a memory leak due to a retain cycle.

    Declaration

    Objective-C

    @property (nonatomic, weak) PSPDFDocumentFeatures *_Nullable features;

    Swift

    weak var features: PDFDocumentFeatures? { get set }
  • Specifies whether the document this feature belongs to can be modified.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canModify;

    Swift

    optional var canModify: Bool { get }
  • Specifies whether bookmarks can be added, removed or edited in the document this feature belongs.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canEditBookmarks;

    Swift

    optional var canEditBookmarks: Bool { get }
  • Specifies whether the document can be printed on this device.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canPrint;

    Swift

    optional var canPrint: Bool { get }
  • Specifies whether annotation replies should be shown.

    Disabling showing replies also disables showing annotation reviews.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canShowAnnotationReplies;

    Swift

    optional var canShowAnnotationReplies: Bool { get }
  • Specifies whether annotation reviews should be shown.

    Reviews are one of these author states: accepted, rejected, cancelled, or completed.

    This feature will be never be enabled if the canShowAnnotationReplies feature is disabled.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canShowAnnotationReviews;

    Swift

    optional var canShowAnnotationReviews: Bool { get }
  • Specifies whether the user can add, rotate, or delete pages.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canUseDocumentEditor;

    Swift

    optional var canUseDocumentEditor: Bool { get }
  • Specifies whether the user can fill interactive forms.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canFillForms;

    Swift

    optional var canFillForms: Bool { get }
  • Specifies whether the user can add or modify annotations.

    Returning false is equivalent to setting PSPDFConfiguration.editableAnnotationTypes to nil.

    The user will still be able to fill forms if canFillForms is true, even if canEditAnnotations is false.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canEditAnnotations;

    Swift

    optional var canEditAnnotations: Bool { get }
  • Specifies whether the user can extract text and images from the document.

    If false, the user won’t be able to copy or share selected text or images.

    Declaration

    Objective-C

    @optional
    @property (nonatomic, readonly) BOOL canExtractTextAndImages;

    Swift

    optional var canExtractTextAndImages: Bool { get }