PSPDFFileManager

@protocol PSPDFFileManager <NSObject>

Wraps file system calls. Internal class cluster. Can be replaced with Enterprise SDK wrappers like Good Technology or MobileIron AppConnect.

  • If YES, then we can’t use certain more optimized methods like UIGraphicsBeginPDFContextToFile since they would use write methods that we can’t override.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL usesEncryption;

    Swift

    var usesEncryption: Bool { get }
  • We query the file manager for exceptions where we require unencrypted files on disk. This method expects to return YES for any type if usesEncryption returns NO. Various features in PSPDFKit require unencrypted files while usage (Open In, QuickLook, Audio Recording)

    Declaration

    Objective-C

    - (BOOL)allowsPolicyEvent:(nonnull NSString *)policyEvent;

    Swift

    func allowsPolicyEvent(_ policyEvent: String) -> Bool
  • Copies a file to an unencrypted location if the security check passes.

    Declaration

    Objective-C

    - (nullable NSURL *)
    copyFileToUnencryptedLocationIfRequired:(nullable NSURL *)fileURL
                                policyEvent:(nonnull NSString *)policyEvent
                                      error:(NSError *_Nullable *_Nullable)error;

    Swift

    func copyFile(toUnencryptedLocationIfRequired fileURL: URL?, policyEvent: String) throws -> URL
  • Cleans up a temporary file. Searches both in encrypted store (if encrypted) and default disk store.

    Declaration

    Objective-C

    - (BOOL)cleanupIfTemporaryFile:(nonnull NSURL *)URL;

    Swift

    func cleanupIfTemporaryFile(_ URL: URL) -> Bool
  • This method creates a data provider pointing to temporary data storage that is writable. Especially when processing documents, it might be necessary to create temporary files and using this, you can secure the temporary files however you like. By default, this creates a PSPDFFileDataProvider pointing to a temporary file.

    Declaration

    Objective-C

    - (nullable id<PSPDFDataProvider>)createTemporaryWritableDataProviderWithPrefix:
        (nullable NSString *)prefix;

    Swift

    func createTemporaryWritableDataProvider(withPrefix prefix: String?) -> PSPDFDataProvider?
  • Declaration

    Objective-C

    - (BOOL)writeData:(nonnull NSData *)data
               toFile:(nonnull NSString *)path
              options:(NSDataWritingOptions)writeOptionsMask
                error:(NSError *_Nullable *_Nullable)error;

    Swift

    func write(_ data: Data, toFile path: String, options writeOptionsMask: NSData.WritingOptions = []) throws
  • Undocumented

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>
  • Declaration

    Objective-C

    - (nullable NSData *)
    dataWithContentsOfFile:(nonnull NSString *)path
                   options:(NSDataReadingOptions)readOptionsMask
                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func data(withContentsOfFile path: String, options readOptionsMask: NSData.ReadingOptions = []) throws -> Data
  • Undocumented

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>
  • Declaration

    Objective-C

    - (BOOL)copyItemAtURL:(nonnull NSURL *)sourceURL
                    toURL:(nonnull NSURL *)destinationURL
                    error:(NSError *_Nullable *_Nullable)error;

    Swift

    func copyItem(at sourceURL: URL, to destinationURL: URL) throws
  • Undocumented

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>
  • Declaration

    Objective-C

    - (BOOL)replaceItemAtURL:(nonnull NSURL *)originalItemURL
               withItemAtURL:(nonnull NSURL *)newItemURL
              backupItemName:(nullable NSString *)backupItemName
                     options:(NSFileManagerItemReplacementOptions)options
            resultingItemURL:(NSURL *_Nullable *_Nullable)resultingURL
                       error:(NSError *_Nullable *_Nullable)error;

    Swift

    func replaceItem(at originalItemURL: URL, withItemAt newItemURL: URL, backupItemName: String?, options: FileManager.ItemReplacementOptions = [], resultingItemURL resultingURL: AutoreleasingUnsafeMutablePointer
  • Declaration

    Objective-C

    - (BOOL)removeItemAtPath:(nonnull NSString *)path
                       error:(NSError *_Nullable *_Nullable)error;

    Swift

    func removeItem(atPath path: String) throws
  • Undocumented

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>
  • Declaration

    Objective-C

    - (nullable NSDictionary<NSString *, id> *)
    attributesOfFileSystemForPath:(nonnull NSString *)path
                            error:(NSError *_Nullable *_Nullable)error;

    Swift

    func attributesOfFileSystem(forPath path: String) throws -> [String : Any]
  • Undocumented

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>
  • Undocumented

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>
  • Undocumented

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>
  • Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)
    contentsOfDirectoryAtPath:(nonnull NSString *)path
                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    func contentsOfDirectory(atPath path: String, error: NSErrorPointer) -> [String]
  • Undocumented

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>