PSPDFAction

Objective-C


@interface PSPDFAction : PSPDFModel <NSSecureCoding>

Swift

class Action : ModelObject, NSSecureCoding

Defines an action that is defined in the PDF spec, either from an outline or an annotation object. See the Adobe PDF Specification for more about actions and action types.

Note

The PDF spec defines both ‘destinations’ and ‘actions’. PSPDFKit will convert a ‘destination’ into an equivalent PSPDFActionTypeGoTo.
  • Return the class responsible for actionType.

    Declaration

    Objective-C

    + (nullable Class)actionClassForType:(PSPDFActionType)actionType;

    Swift

    class func actionClass(for actionType: Action.Kind) -> AnyClass?
  • The PDF action type.

    Declaration

    Objective-C

    @property (nonatomic, readonly) PSPDFActionType type;

    Swift

    var type: Action.Kind { get }
  • The actions parent action. Only set if it is a subAction of another action. Automatically set when assigning subActions on the parent action.

    Declaration

    Objective-C

    @property (weak, readonly) PSPDFAction *_Nullable parentAction;

    Swift

    weak var parent: Action? { get }
  • PDF actions can be chained together. Defines the sub actions.

    Declaration

    Objective-C

    @property (nonatomic) NSArray<PSPDFAction *> *_Nonnull subActions;

    Swift

    var subActions: [Action] { get set }
  • If the action contained a pspdfkit:// URL, options between the URL will be parsed and extracted as key/value. Can also be used for generic key/value storage (but remember that PSPDFActions usually are regenerated when using any of the convenience setters) Will be persisted externally but not within PDF documents.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDictionary<PSPDFActionOption, id> *options;

    Swift

    var options: [Action.Option : Any]? { get }
  • Returns the most appropriate description (Like “Page 3” or “https://www.pspdfkit.com/”) for the action.

    Declaration

    Objective-C

    - (nonnull NSString *)localizedDescriptionWithDocumentProvider:
        (nullable PSPDFDocumentProvider *)documentProvider;

    Swift

    func localizedDescription(with documentProvider: PSPDFDocumentProvider?) -> String

    Parameters

    documentProvider

    Used to resolve named destinations and page labels. (Optional)

  • Returns a user representable string for the action type (Like “Link”, “Open File”, or “Submit Form”).

    Note

    This is an empty string for the base class, but subclasses might override it.

    Declaration

    Objective-C

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

    Swift

    var localizedActionType: String { get }
  • An optional array, specifying the form fields to include or exclude (based on the flags property) when executing this action.

    Fields can be identified by their objectNumber or their fullyQualifiedName.

    From the PDF Reference, version 1.7:

    (Optional) An array identifying which fields to reset or which to exclude from resetting, depending on the setting of the Include/Exclude flag in the Flags entry (see Table 239). Each element of the array shall be either an indirect reference to a field dictionary or (PDF 1.3) a text string representing the fully qualified name of a field. Elements of both kinds may be mixed in the same array. If this entry is omitted, the Include/Exclude flag shall be ignored; all fields in the document’s interactive form are reset.

    Declaration

    Swift

    public var fieldIdentifiers: [FieldIdentifier]? { get set }
  • Possible ways to identify a FormField in the context of the fieldIdentifiers property.

    See more

    Declaration

    Swift

    public enum FieldIdentifier
    extension AbstractFormAction.FieldIdentifier: ExpressibleByIntegerLiteral, ExpressibleByStringLiteral, Equatable