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).
-
-
Method Summary
Modifier and Type Method Description String
getServerUrl()
Returns the server URL the client was created with. String
getDataPath()
Returns the data path the client was created with. 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
.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
.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
.synchronized void
removeLocalStorage()
Removes local storage for this client. synchronized void
removeLocalStorageForDocument(@NonNull() String documentId)
Invalidates all layers of the document with the given ID and removes its local storage. synchronized List<InstantDocumentDescriptor>
getLocalDocumentDescriptors()
Returns document descriptors for locally cached documents. InstantPdfDocument
openDocument(@NonNull() String jwt)
Downloads and opens document from Instant Server (PSPDFKit Document Engine) synchronously. Single<InstantPdfDocument>
openDocumentAsync(@NonNull() String jwt)
Downloads and opens document from Instant Server (PSPDFKit Document Engine), asynchronously. synchronized InstantDocumentDescriptor
getInstantDocumentDescriptorForJwt(@NonNull() String jwt)
Returns the document descriptor matching the data encoded in the given JWT. -
-
Method Detail
-
getServerUrl
@NonNull() String getServerUrl()
Returns the server URL the client was created with.
-
getDataPath
@NonNull() String getDataPath()
Returns the data path the client was created with.
-
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 useserverUrl
- 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 useserverUrl
- 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 useserverUrl
- 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.
-
openDocument
@NonNull() InstantPdfDocument openDocument(@NonNull() String jwt)
Downloads and opens document from Instant Server (PSPDFKit Document Engine) synchronously.
- Parameters:
jwt
- The JWT defining the document and its layer.- Returns:
Opened document (InstantPdfDocument).
-
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.
-
getInstantDocumentDescriptorForJwt
@NonNull() synchronized InstantDocumentDescriptor getInstantDocumentDescriptorForJwt(@NonNull() String jwt)
Returns the document descriptor matching the data encoded in the given JWT.
- Parameters:
jwt
- The JWT defining the document and its layer.
-
-
-
-