PSPDFOutlineElement

Objective-C


@interface PSPDFOutlineElement : PSPDFModel

Swift

class OutlineElement : ModelObject

Represents a single outline/table of contents element.

  • Init with title, page, child elements and indentation level.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithTitle:(nullable NSString *)title
                color:(nullable UIColor *)color
           fontTraits:(UIFontDescriptorSymbolicTraits)fontTraits
               action:(nullable PSPDFAction *)action
             children:(nullable NSArray<PSPDFOutlineElement *> *)children
                level:(NSUInteger)level;

    Swift

    init(title: String?, color: UIColor?, fontTraits: UIFontDescriptor.SymbolicTraits, action: PSPDFAction?, children: [OutlineElement]?, level: UInt)
  • Returns all elements + flattened subelements if they are expanded

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSArray<PSPDFOutlineElement *> *_Nonnull flattenedChildren;

    Swift

    var flattenedChildren: [OutlineElement] { get }
  • All elements, ignores expanded state.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSArray<PSPDFOutlineElement *> *_Nonnull allFlattenedChildren;

    Swift

    var allFlattenedChildren: [OutlineElement] { get }
  • Outline elements parent. nil if it has no parent.

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly) PSPDFOutlineElement *_Nullable parent;

    Swift

    weak var parent: OutlineElement? { get }
  • Outline title.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *title;

    Swift

    var title: String? { get }
  • Outline action (page change, URL)

    Note

    As a performance optimization, the action will be resolved lazily on first access in most cases. You should avoid accessing this property in large batches to avoid lag in complex PDF documents.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) PSPDFAction *action;

    Swift

    var action: PSPDFAction? { get }
  • Convenience shortcut for self.action.pageIndex (if action is of type PSPDFGoToAction)

    Page is set to NSNotFound if action is nil or a different type.

    Note

    As a performance optimization, the action will be resolved lazily on first access in most cases. You should avoid accessing this property in large batches to avoid lag in complex PDF documents.

    Declaration

    Objective-C

    @property (nonatomic, readonly) PSPDFPageIndex pageIndex;

    Swift

    var pageIndex: PageIndex { get }
  • Bookmark can have a color. (Optional; PDF 1.4) PSPDFKit defaults to system text color when presenting if nil.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) UIColor *color;

    Swift

    var color: UIColor? { get }
  • A bookmark can be optionally bold or italic. (Optional; PDF 1.4)

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIFontDescriptorSymbolicTraits fontTraits;

    Swift

    var fontTraits: UIFontDescriptor.SymbolicTraits { get }
  • Child elements.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSArray<PSPDFOutlineElement *> *children;

    Swift

    var children: [OutlineElement]? { get }
  • Current outline level.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger level;

    Swift

    var level: UInt { get }
  • Expansion state of current outline element (will not be persisted)

    Declaration

    Objective-C

    @property (getter=isExpanded) BOOL expanded;

    Swift

    var isExpanded: Bool { get set }