PTPageLabelManager


@interface PTPageLabelManager : NSObject <PTOverridable>

Instances of the PTPageLabelManager class manage the page labels associated with the PTPDFDoc of a PTPDFViewCtrl instance.

  • Initializes a PTPageLabelManager instance.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPDFViewCtrl:
        (nonnull PTPDFViewCtrl *)pdfViewCtrl;

    Swift

    init(pdfViewCtrl: PTPDFViewCtrl)

    Parameters

    pdfViewCtrl

    the PDFViewCtrl

    Return Value

    an initialized PTPageLabelManager instance

  • The PTPDFViewCtrl associated with this page label manager.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) PTPDFViewCtrl *pdfViewCtrl;

    Swift

    var pdfViewCtrl: PTPDFViewCtrl? { get set }
  • Returns the page label for the given page number of the current PTPDFDoc in the pdfViewCtrl.

    Declaration

    Objective-C

    - (nullable PTPageLabel *)pageLabelForPageNumber:(int)pageNumber;

    Swift

    func pageLabel(forPageNumber pageNumber: Int32) -> PTPageLabel?

    Parameters

    pageNumber

    the page number for which to get the label

    Return Value

    the page label for the given page number, or nil if no page label is set

  • Returns the page label prefix for the given page number of the current PTPDFDoc in the pdfViewCtrl.

    Declaration

    Objective-C

    - (nullable NSString *)pageLabelPrefixForPageNumber:(int)pageNumber;

    Swift

    func pageLabelPrefix(forPageNumber pageNumber: Int32) -> String?

    Parameters

    pageNumber

    the page number for which to get the label prefix

    Return Value

    the page label prefix for the given page number, or nil if no page label is set

  • Returns the page label title for the given page number of the current PTPDFDoc in the pdfViewCtrl.

    Declaration

    Objective-C

    - (nullable NSString *)pageLabelTitleForPageNumber:(int)pageNumber;

    Swift

    func pageLabelTitle(forPageNumber pageNumber: Int32) -> String?

    Parameters

    pageNumber

    the page number for which to get the label title

    Return Value

    the page label title for the given page number, or nil if no page label is set

  • Returns the page number for the given page label title of the current PTPDFDoc in the pdfViewCtrl.

    Declaration

    Objective-C

    - (int)pageNumberForPageLabelTitle:(nonnull NSString *)pageLabelTitle;

    Swift

    func pageNumber(forPageLabelTitle pageLabelTitle: String) -> Int32

    Parameters

    pageLabelTitle

    the page number for the given page label title, or 0 if the page label cannot be found

    Return Value

    the page number for the given page label title, or 0 if the page label cannot be found

  • Sets the page label for the given page range with the specified style, prefix, and starting value.

    Declaration

    Objective-C

    - (nullable PTPageLabel *)setPageLabelStyle:(PTPageLabelStyle)pageLabelStyle
                                 fromPageNumber:(int)firstPageNumber
                                   toPageNumber:(int)lastPageNumber;

    Swift

    func setPageLabelStyle(_ pageLabelStyle: PTPageLabelStyle, fromPageNumber firstPageNumber: Int32, toPageNumber lastPageNumber: Int32) -> PTPageLabel?

    Parameters

    pageLabelStyle

    one of e_ptdecimal, e_ptroman_uppercase, e_ptroman_lowercase, e_ptalphabetic_uppercase, e_ptalphabetic_lowercase, or e_ptpg_none

    firstPageNumber

    the first page number associated with this page label

    lastPageNumber

    the last page associated with this page label

    Return Value

    the page label set to this page, or nil if unsuccessfully set

  • Sets the page label for the given page range with the specified style, prefix, and starting value.

    Declaration

    Objective-C

    - (nullable PTPageLabel *)setPageLabelStyle:(PTPageLabelStyle)pageLabelStyle
                                         prefix:(nullable NSString *)prefix
                                     startValue:(int)startValue
                                 fromPageNumber:(int)firstPageNumber
                                   toPageNumber:(int)lastPageNumber;

    Swift

    func setPageLabelStyle(_ pageLabelStyle: PTPageLabelStyle, prefix: String?, startValue: Int32, fromPageNumber firstPageNumber: Int32, toPageNumber lastPageNumber: Int32) -> PTPageLabel?

    Parameters

    pageLabelStyle

    one of e_ptdecimal, e_ptroman_uppercase, e_ptroman_lowercase, e_ptalphabetic_uppercase, e_ptalphabetic_lowercase, or e_ptpg_none

    prefix

    text to prepend to the page label title

    startValue

    the value to use when generating the numeric portion of the first label in this range

    firstPageNumber

    the first page number associated with this page label

    lastPageNumber

    the last page associated with this page label

    Return Value

    the page label set to this page, or nil if unsuccessfully set

  • Removes all of the page labels of the PTPDFDoc in the pdfViewCtrl.

    Declaration

    Objective-C

    - (void)removeAllPageLabels;

    Swift

    func removeAllPageLabels()
  • Executes a given block for every page label’s pages of the PTPDFDoc in the pdfViewCtrl. The block is executed for every page number that a page label applies.

    Declaration

    Objective-C

    - (void)enumeratePageLabelsStartingAtPageNumber:(int)startPageNumber
                                          withBlock:(nonnull void (^)(
                                                        PTPageLabel *_Nonnull, int,
                                                        BOOL *_Nonnull))block;

    Swift

    func enumeratePageLabelsStarting(atPageNumber startPageNumber: Int32, with block: @escaping (PTPageLabel, Int32, UnsafeMutablePointer<ObjCBool>) -> Void)

    Parameters

    startPageNumber

    the page number at which to begin enumerating the page labels

    block

    the block to execute for every page label’s pages