PSPDFURLAction
Objective-C
@interface PSPDFURLAction : PSPDFAction
Swift
class URLAction : Action
Opens a URL target.
This can be similar to a PSPDFRemoteGoToAction
if a pspdfkit://
URL with a page target is used.
-
Creates a URL action with no URL and default options.
Declaration
Objective-C
- (nonnull instancetype)init;
Swift
init()
-
Creates a URL action from a URL as a string.
If the string doesn’t form a valid URL (according to
NSURL
), the action’s URL will be nil. In this caseinvalidURLString
will not be set and the invalid URL won’t be written into the PDF when saving.Declaration
Objective-C
- (nonnull instancetype)initWithURLString:(nonnull NSString *)URLString;
Swift
init(urlString URLString: String)
-
Creates a URL action with a
URL
andoptions
.This is a designated initializer.
options
keys areAction.Option
.Declaration
Objective-C
- (nonnull instancetype) initWithURL:(nullable NSURL *)url options:(nullable NSDictionary<PSPDFActionOption, id> *)options;
-
The annotation URL target.
If the URL in the PDF is invalid, this property will be nil and
invalidURLString
will be set.Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSURL *URL;
Swift
var url: URL? { get }
-
The unmodified and unparsed URL.
If the URL in the PDF is invalid, this property will be nil and
invalidURLString
will be set. -
A string, read from the PDF, that isn’t a valid URL.
When reading a PDF that contains an action with an invalid URL, the
URL
andunmodifiedURL
properties will be nil, and this property will contain the invalid URL. IfURL
is not nil, then this property will always be nil. However both properties will be nil if you programmatically create a URL action from a string that isn’t a valid URL.The validity of the URL is determined by
NSURL
. The parser changed to RFC 3986 for apps linked on or after iOS 17.Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *invalidURLString;
Swift
var invalidURLString: String? { get }
-
This will convert
pspdfkit://
URLs or localhost URLs that use path tokens into their expanded form, and will override the options dictionary with any option found in the URL. If the URL has already been processed, this will not do anything.Declaration
Objective-C
- (BOOL)updateURLWithAnnotationManager: (nonnull PSPDFAnnotationManager *)annotationManager;
Swift
func updateURL(with annotationManager: PSPDFAnnotationManager) -> Bool
Return Value
YES if the URL has been updated.
-
Returns YES if the
URLString
has been prefixed with pspdfkit:// or another defined prefix set inDocument
.Declaration
Objective-C
@property (nonatomic, readonly) BOOL isPSPDFPrefixed;
Swift
var isPSPDFPrefixed: Bool { get }
-
The page index, if defined in the options dictionary.
Declaration
Objective-C
@property (nonatomic) PSPDFPageIndex pageIndex;
Swift
var pageIndex: PageIndex { get set }
-
Indicator if “modal” is set in options. Will add “modal” to options if
setModal:
is used.Declaration
Objective-C
@property (nonatomic, getter=isModal) BOOL modal;
Swift
var isModal: Bool { get set }
-
Indicator if “popover” is set in options. Will add “popover” to options if
setPopover:
is used.Declaration
Objective-C
@property (nonatomic, getter=isPopover) BOOL popover;
Swift
var isPopover: Bool { get set }
-
Indicator if “button” is set in options. Will add “button” to options if
setButton:
is used.Declaration
Objective-C
@property (nonatomic, getter=isButton) BOOL button;
Swift
var isButton: Bool { get set }
-
Tries to extract a size out of options “size”. Returns
CGSizeZero
if conversion fails.Declaration
Objective-C
@property (nonatomic) CGSize size;
Swift
var size: CGSize { get set }
-
Video offset.
Declaration
Objective-C
@property (nonatomic) CGFloat offset;
Swift
var offset: CGFloat { get set }
-
Regenerates a
pspdfkit://
style string IFisPSPDFPrefixed
is set.Declaration
Objective-C
- (nullable NSString *)prefixedURLStringWithAnnotationManager: (nonnull PSPDFAnnotationManager *)annotationManager;
Swift
func prefixedURLString(with annotationManager: PSPDFAnnotationManager) -> String?
-
Helper to determine if the URL is an email and to configure the mail controller for email, subject, cc, bcc and body.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isEmailURL) BOOL emailURL;
Swift
var isEmailURL: Bool { get }
-
Determines whether the URL points to a local file.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isLocalPDFURL) BOOL localPDFURL;
Swift
var isLocalPDFURL: Bool { get }
-
Undocumented
Declaration
Objective-C
- (BOOL)configureMailComposeViewController:(MFMailComposeViewController *)mailComposeViewController;
Swift
func configureMailComposeViewController(_ mailComposeViewController: MFMailComposeViewController) -> Bool