PSPDFEmbeddedFile

Objective-C


@interface PSPDFEmbeddedFile : PSPDFModel

Swift

class EmbeddedFile : ModelObject

Represents an embedded file.

  • Initializes a PSPDFEmbeddedFile with the given fileName, fileURL, fileDescription, and modificationDate.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithFileURL:(nonnull NSURL *)fileURL
                            fileDescription:(nullable NSString *)fileDescription;

    Swift

    init(fileURL: URL, fileDescription: String?)

    Parameters

    fileURL

    A local file URL of the attachment.

    fileDescription

    The optional description of the file. If set, it will override the file annotation’s contents.

    Return Value

    A new embedded file provider.

  • The document, if available.

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly) PSPDFDocument *_Nullable document;

    Swift

    weak var document: PSPDFDocument? { get }
  • File name.

    Declaration

    Objective-C

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

    Swift

    var fileName: String { get }
  • File size.

    Declaration

    Objective-C

    @property (nonatomic, readonly) uint64_t fileSize;

    Swift

    var fileSize: UInt64 { get }
  • File description. Optional.

    Note

    If the embedded file is part of a PSPDFFileAnnotation the value of fileDescription is equal to the file annotation’s contents.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *fileDescription;

    Swift

    var fileDescription: String? { get }
  • File modification date (if set).

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDate *modificationDate;

    Swift

    var modificationDate: Date? { get }
  • If the file URL has been extracted by XFDF or external saving, it is set here.

    Note

    In most cases, you should call fileURLWithError: instead to fetch the URL.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSURL *fileURL;

    Swift

    var fileURL: URL? { get }
  • Retrieves the embedded stream and returns a file URL to the data. This also sets fileURL if successful.

    Declaration

    Objective-C

    - (nullable NSURL *)fileURLWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func fileURLWithError() throws -> URL

    Return Value

    a file URL to the data.