PSPDFOutlineElement

Objective-C


@interface PSPDFOutlineElement : PSPDFModel
extension OutlineElement: Identifiable

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 NSColor *)color
           fontTraits:(NSFontDescriptorSymbolicTraits)fontTraits
               action:(nullable PSPDFAction *)action
             children:(nullable NSArray<PSPDFOutlineElement *> *)children
                level:(NSUInteger)level;

    Swift

    init(title: String?, color: NSColor?, fontTraits: NSFontDescriptor.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 }
  • Unique identifier, created at parse time.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull uuid;

    Swift

    var uuid: String { 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) NSColor *color;

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSFontDescriptorSymbolicTraits fontTraits;

    Swift

    var fontTraits: NSFontDescriptor.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 }
  • id

    Maps UUID to id to conform to the identifiable protocol.

    Declaration

    Swift

    public var id: String { get }