PSPDFNamedAction

Objective-C


@interface PSPDFNamedAction : PSPDFAction

Swift

class NamedAction : Action

Defines methods used to work with actions in PDF documents, some of which are named in the Adobe PDF Specification.

  • Initialize with string. Will parse action, set to PSPDFNamedActionTypeUnknown if not recognized or nil.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithActionNamedString:
        (nullable NSString *)actionNameString;

    Swift

    init(actionNamedString actionNameString: String?)
  • Initialize with a specific named action type.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithNamedActionType:
        (PSPDFNamedActionType)namedActionType;

    Swift

    init(namedActionType: NamedActionType)
  • The type of the named action.

    Note

    Will update namedAction if set.

    Declaration

    Objective-C

    @property (nonatomic, readonly) PSPDFNamedActionType namedActionType;

    Swift

    var namedActionType: NamedActionType { get }
  • The string of the named action.

    Note

    Will update namedActionType if set.

    Declaration

    Objective-C

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

    Swift

    var namedAction: String? { get }
  • Returns the target page for certain named actions.

    The named actions supported by this method are .nextPage, .previousPage, .firstPage, and lastPage. For other types this will return NSNotFound. This also returns NSNotFound if the provided current page is out of bounds or if the target page would be out of bounds. This will not resolve the target page index for goBack and goForward actions because the navigation history is part of the UI rather than part of the model. It will return NSNotFound for those.

    Declaration

    Objective-C

    - (PSPDFPageIndex)pageIndexWithCurrentPage:(PSPDFPageIndex)currentPage
                                  fromDocument:(nonnull PSPDFDocument *)document;

    Swift

    func pageIndex(withCurrentPage currentPage: PageIndex, from document: PSPDFDocument) -> PageIndex

    Return Value

    The target page, or NSNotFound if there is no target page.