PSPDFFile
Objective-C
@interface PSPDFFile : PSPDFModel
Swift
class File : ModelObject
Undocumented
-
Initialize with a name and an URL or data. (do not set both, but needs at least one)
Declaration
Objective-C
- (nonnull instancetype)initWithName:(nonnull NSString *)fileName URL:(nullable NSURL *)fileURL data:(nullable NSData *)fileData;
Swift
init(name fileName: String, url fileURL: URL?, data fileData: Data?)
-
The name of the file.
Declaration
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull fileName;
Swift
var fileName: String { get }
-
The location of the file.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSURL *fileURL;
Swift
var fileURL: URL? { get }
-
Data representation of the file. If not set at construction time, we try to memory-map it on access.
Note
CallingfileDataMappedWithError:
is recommended, so potential errors can be caught.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSData *fileData;
Swift
var fileData: Data? { get }
-
The mime type of the document as derived from
fileName
, falling back toapplication/pdf
if no mime type could be derived.Declaration
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull mimeType;
Swift
var mimeType: String { get }
-
Returns either the set data, or a memory-mapped version of
fileURL
. Guaranteed to not return an empty NSData object.Declaration
Objective-C
- (nullable NSData *)fileDataMappedWithError: (NSError *_Nullable *_Nullable)error;
Swift
func fileDataMapped() throws -> Data