PSPDFJavaScriptAction


@interface PSPDFJavaScriptAction : PSPDFAction

Defines an action that contains JavaScript to be executed in the document context.

  • Designated initializer.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithScript:(nonnull NSString *)script;

    Swift

    init(script: String)
  • The javascript content.

    Declaration

    Objective-C

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

    Swift

    var script: String? { get }
  • Tries to execute the JavaScript in the context of a document provider. Use the event params to override certain values for the event object in the executed script.

    Declaration

    Objective-C

    - (nullable NSDictionary<NSString *, id> *)
    executeScriptAppliedToDocumentProvider:
        (nonnull PSPDFDocumentProvider *)documentProvider
                               application:(nullable id<PSPDFApplicationJSExport>)
                                               application
                           eventDictionary:(nullable NSDictionary<NSString *, id> *)
                                               eventDictionary
                                    sender:(nullable id)sender
                                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func executeScriptApplied(to documentProvider: PSPDFDocumentProvider, application: PSPDFApplicationJSExport?, eventDictionary: [String : Any]?, sender: Any?) throws -> [String : Any]