PSPDFSaveViewControllerDelegate

@protocol PSPDFSaveViewControllerDelegate<NSObject>

/**
 Called when the done button is pressed, and the file should be saved to the selected location.
 The delegate needs to handle the actual saving process.

 @note This will be called with a temporary URL if `PSPDFDirectory.documentPickerDirectory` has been selected,
 to allow the document picker to move the file to the final location. You should not rely on that file to persist at the temporary location.

 @param controller The current save view controller.
 @param url The URL the file should be saved to, considering the current `selectedSaveDirectory`.
 @param completionHandler Call the completion handler once saving finished with the final URL the file was saved to,
 or if an error occurred before or during saving.
 If an error is provided, an alert is shown with the error's `localizedDescription` as content.
 */
- (void)saveViewController:(PSPDFSaveViewController *)controller saveFileToURL:(NSURL *)url completionHandler:(void (^)(NSURL *_Nullable url, NSError *_Nullable error))completionHandler;

/**
 Called when the save view controller finished with a selected URL.
 This will only ever be called after the completion handler of
 `-saveViewController:saveFileToURL:completionHandler:` has been called.

 You should dismiss the save controller in this delegate.
*/
- (void)saveViewController:(PSPDFSaveViewController *)controller didFinishWithURL:(NSURL *)url;

/**
 Called when the directory save view controller cancelled.
 You should dismiss the save controller in this delegate.
*/
- (void)saveViewControllerDidCancel:(PSPDFSaveViewController *)controller;

@end

Undocumented

  • Called when the done button is pressed, and the file should be saved to the selected location. The delegate needs to handle the actual saving process.

    Note

    This will be called with a temporary URL if PSPDFDirectory.documentPickerDirectory has been selected, to allow the document picker to move the file to the final location. You should not rely on that file to persist at the temporary location.

    Declaration

    Objective-C

    - (void)saveViewController:(nonnull PSPDFSaveViewController *)controller
                 saveFileToURL:(nonnull NSURL *)url
             completionHandler:
                 (nonnull void (^)(NSURL *_Nullable,
                                   NSError *_Nullable))completionHandler;

    Swift

    func saveViewController(_ controller: PSPDFSaveViewController, saveFileTo url: URL, completionHandler: @escaping (URL?, Error?) -> Void)

    Parameters

    controller

    The current save view controller.

    url

    The URL the file should be saved to, considering the current selectedSaveDirectory.

    completionHandler

    Call the completion handler once saving finished with the final URL the file was saved to, or if an error occurred before or during saving. If an error is provided, an alert is shown with the error’s localizedDescription as content.

  • Called when the save view controller finished with a selected URL. This will only ever be called after the completion handler of -saveViewController:saveFileToURL:completionHandler: has been called.

    You should dismiss the save controller in this delegate.

    Declaration

    Objective-C

    - (void)saveViewController:(nonnull PSPDFSaveViewController *)controller
              didFinishWithURL:(nonnull NSURL *)url;

    Swift

    func saveViewController(_ controller: PSPDFSaveViewController, didFinishWith url: URL)
  • Called when the directory save view controller cancelled. You should dismiss the save controller in this delegate.

    Declaration

    Objective-C

    - (void)saveViewControllerDidCancel:
        (nonnull PSPDFSaveViewController *)controller;

    Swift

    func saveViewControllerDidCancel(_ controller: PSPDFSaveViewController)