PSPDFPageLabelFormatter
Objective-C
@interface PSPDFPageLabelFormatter : NSFormatter
Swift
class PageLabelFormatter : Formatter
A formatter to convert a range of pages into a user facing string.
The page label formatter uses the label of a document’s page if it has one assigned to it and falls back to the page number (the page index + 1 that is) otherwise.
All page ranges are treated as referring to a page’s index, starting at 0. The first page therefore has index 0 and is visualized as page 1 if there is no label set for the page.
-
Creates a user facing string that represents the given page range for the given document.
Declaration
Objective-C
+ (nonnull NSString *)localizedStringFromPageRange:(NSRange)pageRange document: (nonnull PSPDFDocument *)document;
Swift
class func localizedString(fromPageRange pageRange: NSRange, document: PSPDFDocument) -> String
Parameters
pageRange
The range of pages to visualize, referring to the page indexes.
document
The document the page range belongs to, used to derive information such as the label of pages.
Return Value
A localized string representing the passed in page range.
-
The document this formatter is using to derive page labels and other informations about the page ranges it is formatting.
Declaration
Objective-C
@property (nonatomic, nullable) PSPDFDocument *document;
Swift
var document: PSPDFDocument? { get set }
-
Creates a user facing string that represents the given page range for the document assigned to the receiver.
Declaration
Objective-C
- (nonnull NSString *)stringFromRange:(NSRange)pageRange;
Swift
func string(from pageRange: NSRange) -> String
Parameters
pageRange
The range of pages to visualize, referring to the page indexes.
Return Value
A localized string representing the passed in page range.