Class InstantClient

  • All Implemented Interfaces:

    
    public final class InstantClient
    
                        

    The entry point to PSPDFKit Instant, representing a client’s connection to the Instant Server (PSPDFKit Document Engine).

    • Constructor Detail

    • Method Detail

      • create

        @NonNull() static InstantClient create(@NonNull() Context context, @NonNull() URL serverUrl)

        Creates Instant Server (PSPDFKit Document Engine) client that is going to connect to server at serverUrl.

        Parameters:
        context - The context to use
        serverUrl - Instant Server (PSPDFKit Document Engine) url.
      • create

        @NonNull() static InstantClient create(@NonNull() Context context, @NonNull() HttpUrl serverUrl)

        Creates Instant Server (PSPDFKit Document Engine) client that is going to connect to server at serverUrl.

        Parameters:
        context - The context to use
        serverUrl - Instant Server (PSPDFKit Document Engine) url.
      • create

        @NonNull() static InstantClient create(@NonNull() Context context, @NonNull() String serverUrl)

        Creates Instant Server (PSPDFKit Document Engine) client that is going to connect to server at serverUrl.

        Parameters:
        context - The context to use
        serverUrl - Instant Server (PSPDFKit Document Engine) url.
      • removeLocalStorage

         synchronized void removeLocalStorage()

        Removes local storage for this client. This includes all documents and other client data. All opened documents will get invalidated.

        Use this method to remove locally cached Instant documents when you no longer need them on the device (e.g. when signing out).

      • removeLocalStorageForDocument

         synchronized void removeLocalStorageForDocument(@NonNull() String documentId)

        Invalidates all layers of the document with the given ID and removes its local storage.

        Use this method to remove locally cached data for a single Instant document when you no longer need it on the device.

      • getLocalDocumentDescriptors

        @NonNull() synchronized List<InstantDocumentDescriptor> getLocalDocumentDescriptors()

        Returns document descriptors for locally cached documents. You can use this to access documents that are already downloaded and cached on the device, even while the device is offline.

        Returns:

        List of locally cached document descriptors.

      • openDocumentAsync

        @NonNull() Single<InstantPdfDocument> openDocumentAsync(@NonNull() String jwt)

        Downloads and opens document from Instant Server (PSPDFKit Document Engine), asynchronously.

        • Scheduler:
        • openDocumentAsync does not operate by default on a particular .
        Parameters:
        jwt - The JWT defining the document and its layer.
        Returns:

        Single returning opened InstantPdfDocument or an error when document could not be downloaded or opened.