PSPDFInstantClientDelegate

@protocol PSPDFInstantClientDelegate <NSObject>

The delegate of a PSPDFInstantClient must adopt this protocol to be notified of download and authentication events.

All methods will be called on a background thread.

For multiple observers or to observe a single document, see the coresponding notifications in PSPDFInstantDocumentDescriptor.h.

  • Called when downloading a PDF file from the server finishes. At this point the PDF document can be obtained from the document descriptor.

    Declaration

    Objective-C

    - (void)instantClient:(nonnull PSPDFInstantClient *)instantClient
        didFinishDownloadForDocument:
            (nonnull id<PSPDFInstantDocumentDescriptor>)documentDescriptor;

    Parameters

    documentDescriptor

    The descriptor of the document whose download finished.

  • Called when downloading a PDF file from the server fails.

    Declaration

    Objective-C

    - (void)instantClient:(nonnull PSPDFInstantClient *)instantClient
        didFailDownloadForDocument:
            (nonnull id<PSPDFInstantDocumentDescriptor>)documentDescriptor
                             error:(nonnull NSError *)error;

    Parameters

    documentDescriptor

    The descriptor of the document whose download failed.

    error

    The error that occurred.

  • Called when the document fails to automatically synchronize annotations. The most likely reason is network failure.

    Declaration

    Objective-C

    - (void)instantClient:(nonnull PSPDFInstantClient *)instantClient
        didFailSyncingDocument:
            (nonnull id<PSPDFInstantDocumentDescriptor>)documentDescriptor
                         error:(nonnull NSError *)error;

    Parameters

    documentDescriptor

    The descriptor of the document that failed synchronization.

    error

    The error that occurred.

  • Called when the document fails to authenticate with the PSPDFKit Server to synchronize annotations. This typically means either the user no longer has access to the document or the JWT expired. Your own server should be able to say if the user still has access.

    If the user still has access, obtain a new JWT from your server and set it as the document descriptor’s authenticationToken. If the user no longer has access, stop showing this document to the user and call removeLocalStorageWithError: on the document descriptor.

    Declaration

    Objective-C

    - (void)instantClient:(nonnull PSPDFInstantClient *)instantClient
        didFailAuthenticationForDocument:
            (nonnull id<PSPDFInstantDocumentDescriptor>)documentDescriptor;

    Parameters

    documentDescriptor

    The descriptor of the document that failed authentication.

  • Called when the server document has successfully updated the authentication token.

    Declaration

    Objective-C

    - (void)instantClient:(nonnull PSPDFInstantClient *)instantClient
        didUpdateAuthenticationToken:(nonnull NSString *)validJWT
                         forDocument:(nonnull id<PSPDFInstantDocumentDescriptor>)
                                         documentDescriptor;
  • Called when the server document could not update the authentication token.

    Declaration

    Objective-C

    - (void)instantClient:(nonnull PSPDFInstantClient *)instantClient
        didFailUpdatingAuthenticationTokenForDocument:
            (nonnull id<PSPDFInstantDocumentDescriptor>)documentDescriptor
                                                error:(nonnull NSError *)error;