Interface InstantPdfDocument

    • Constructor Detail

    • Method Detail

      • reauthenticateWithJwt

         abstract void reauthenticateWithJwt(@NonNull() String jwt)

        Updates the token used to authenticate access to the document with a new JWT. This allows annotations to be synced again after the initial token used to download the document has expired.

        Note: This method blocks current thread, waiting for authentication process to complete.

        Parameters:
        jwt - JWT used to authenticate access to the document.
      • reauthenticateWithJwtAsync

        @NonNull() abstract Completable reauthenticateWithJwtAsync(@NonNull() String jwt)

        Updates the token used to authenticate access to the document with a new JWT, asynchronously. This allows annotations to be synced again after the initial JWT used to download the document has expired.

        • Scheduler:
        • reauthenticateWithJwtAsync does not operate by default on a particular .
        Parameters:
        jwt - JWT used to authenticate access to the document.
        Returns:

        Completable emitting failure when authentication fails and completion when authentication succeeds.

      • syncAnnotations

         abstract void syncAnnotations()

        Starts annotation sync and waits for its completion.

      • syncAnnotationsAsync

        @NonNull() abstract Flowable<InstantProgress> syncAnnotationsAsync()

        Syncs annotations with Instant Server (PSPDFKit Document Engine) asynchronously.

        • Scheduler:
        • syncAnnotationsAsync does not operate by default on a particular .
        Returns:

        Flowable emitting annotations sync progress.

      • addInstantDocumentListener

         abstract void addInstantDocumentListener(@NonNull() InstantDocumentListener listener)

        Adds listener for instant document events. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

        Note: All listener methods are dispatched on the main UI thread.

        Parameters:
        listener - InstantDocumentListener that should be notified.
      • notifyConnectivityChanged

         abstract void notifyConnectivityChanged(boolean isConnected)

        Notify Instant that connection has changed. Calling this method is optional. Annotation sync behaves by default as if being connected all the time. Failed requests are retried with increasing backoff when sync fails.

      • removeLocalStorage

         abstract void removeLocalStorage()

        Removes local storage for this document. Document will be invalid after returning from this method. Use this to clean-up locally cached data for documents that won't be used anymore or that has been corrupted due to internal error.

      • setListenToServerChanges

         abstract void setListenToServerChanges(boolean listenToServerChanges)

        Controls whether to listen to server changes for this document.

        When listening to server changes is enabled, changes to document from other clients will be downloaded and applied automatically.

        Parameters:
        listenToServerChanges - true to get immediate server updates.
      • isListeningToServerChanges

         abstract boolean isListeningToServerChanges()

        Checks whether this document listens to server changes.

        When listening to server changes is enabled, changes to document from other clients will be downloaded and applied automatically.

        Returns:

        true when document is listening to server changes, false otherwise.

      • getDelayForSyncingLocalChanges

         abstract long getDelayForSyncingLocalChanges()

        Returns delay of automatic syncing of local changes that were made to the document.

        Returns:

        Delay in ms for automatic pushing of local changes to Instant Server (PSPDFKit Document Engine) or SYNC_LOCAL_CHANGES_DISABLED when automatic pushing of local changes is disabled.

      • setDelayForSyncingLocalChanges

         abstract void setDelayForSyncingLocalChanges(long syncDelay)

        Delay in milliseconds before kicking off automatic sync after local changes are made to the document.

        Setting this to a higher value will reduce the load on the network and reduce energy use but means other users will not see annotation updates as soon, which also increases the chance of sync conflicts. Setting this to a positive value less than 1000 ms may strain the network and battery and is not recommended.

        Important: When using this constant, remember to also disable listening for server changes - Instant’s sync operations are always two-way, so any incoming changes from the server would cause your local changes to be sent to the server.

        Parameters:
        syncDelay - Delay in ms for automatic pushing of local changes to Instant Server (PSPDFKit Document Engine).