PTDocumentControllerDelegate

@protocol PTDocumentControllerDelegate <NSObject>

The methods declared by the PTDocumentControllerDelegate protocol allow the adopting delegate to respond to messages from the PTDocumentController class.

  • The method called when the document controller’s PDF document will be saved.

    Declaration

    Objective-C

    - (void)documentController:(nonnull PTDocumentController *)documentController
              willSaveDocument:(nonnull PTPDFDoc *)pdfDoc;

    Swift

    optional func documentController(_ documentController: PTDocumentController, willSaveDocument pdfDoc: PTPDFDoc)

    Parameters

    documentController

    The object sending the message.

    pdfDoc

    The PDF document that will be saved.

  • The method called when the document controller’s PDF document was saved successfully.

    Declaration

    Objective-C

    - (void)documentController:(nonnull PTDocumentController *)documentController
               didSaveDocument:(nonnull PTPDFDoc *)pdfDoc;

    Swift

    optional func documentController(_ documentController: PTDocumentController, didSaveDocument pdfDoc: PTPDFDoc)

    Parameters

    documentController

    The object sending the message.

    pdfDoc

    The PDF document that was saved.

  • The method called when the document controller’s PDF document could not be saved due to an error.

    Declaration

    Objective-C

    - (void)documentController:(nonnull PTDocumentController *)documentController
         didFailSavingDocument:(nonnull PTPDFDoc *)pdfDoc
                     withError:(nonnull NSError *)error;

    Swift

    optional func documentController(_ documentController: PTDocumentController, didFailSavingDocument pdfDoc: PTPDFDoc, withError error: any Error)

    Parameters

    documentController

    The object sending the message.

    pdfDoc

    The PDF document that could not be saved.

    error

    The error that occurred while saving the document.

  • This method allows the delegate to control whether a cached document should be exported to a different location and is called after a remote document has been fully downloaded or a non-PDF document has finished converting.

    If this method is not implemented, the cached document will be exported.

    Declaration

    Objective-C

    - (BOOL)documentController:(nonnull PTDocumentController *)documentController
        shouldExportCachedDocumentAtURL:(nonnull NSURL *)cachedDocumentUrl;

    Swift

    optional func documentController(_ documentController: PTDocumentController, shouldExportCachedDocumentAt cachedDocumentUrl: URL) -> Bool
  • Implement to override default save location when non-PDFs and remote documents are opened via openDocumentWithURL. If this method is not implemented or nil is returned, the document will be saved to the Documents directory with a unique name.

    Declaration

    Objective-C

    - (nullable NSURL *)documentController:
                            (nonnull PTDocumentController *)documentController
            destinationURLForDocumentAtURL:(nonnull NSURL *)sourceUrl;

    Swift

    optional func documentController(_ documentController: PTDocumentController, destinationURLForDocumentAt sourceUrl: URL) -> URL?
  • This method allows the delegate to control whether a cached document should be deleted after it has been exported to a different location.

    If this method is not implemented, the cached document will be deleted.

    Declaration

    Objective-C

    - (BOOL)documentController:(nonnull PTDocumentController *)documentController
        shouldDeleteCachedDocumentAtURL:(nonnull NSURL *)cachedDocumentUrl;

    Swift

    optional func documentController(_ documentController: PTDocumentController, shouldDeleteCachedDocumentAt cachedDocumentUrl: URL) -> Bool
  • This method allows the delegate to control whether the text search view controller should be dismissed when the document controller’s view disappears.

    If this method is not implemented, the text search view controller will be dismissed.

    Declaration

    Objective-C

    - (BOOL)documentControllerShouldAutomaticallyDismissSearchViewController:
        (nonnull PTDocumentController *)documentViewController;

    Swift

    optional func documentControllerShouldAutomaticallyDismissSearchViewController(_ documentViewController: PTDocumentController) -> Bool
  • This method is called when the panel is opened.

    Declaration

    Objective-C

    - (void)documentController:(nonnull PTDocumentController *)documentController
        didShowLeadingPanelViewController:
            (nonnull UIViewController *)leadingPanelViewController;

    Swift

    optional func documentController(_ documentController: PTDocumentController, didShowLeadingPanelViewController leadingPanelViewController: UIViewController)
  • This method is called when the panel is closed.

    Declaration

    Objective-C

    - (void)documentController:(nonnull PTDocumentController *)documentController
        didDismissLeadingPanelViewController:
            (nonnull UIViewController *)leadingPanelViewController;

    Swift

    optional func documentController(_ documentController: PTDocumentController, didDismissLeadingPanelViewController leadingPanelViewController: UIViewController)