PSPDFEmbeddedFile


@interface PSPDFEmbeddedFile : PSPDFModel

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 (readonly, nonatomic) PSPDFDocument *_Nullable document;

    Swift

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

    Declaration

    Objective-C

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

    Swift

    var fileName: String { get }
  • File size.

    Declaration

    Objective-C

    @property (readonly, nonatomic) 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 (readonly, nonatomic, nullable) NSString *fileDescription;

    Swift

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

    Declaration

    Objective-C

    @property (readonly, nonatomic, 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 (readonly, nonatomic, 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.