public final class

InstantDocumentDescriptor

extends Object
java.lang.Object
   ↳ com.pspdfkit.instant.client.InstantDocumentDescriptor

Class Overview

Descriptor/handle for InstantPdfDocument that provides methods for downloading/opening instant documents.

Each descriptor describes a single Instant document layer defined by the Document id and layer name. Both of these are encoded in the JWT used for authentication provided via openDocumentAsync(String) or downloadDocumentAsync(String).

Summary

Public Methods
synchronized Flowable<InstantProgress> downloadDocumentAsync(String jwt)
Downloads document from instant server asynchronously.
String getCreatorName()
Returns the creator name set in the JWT — if any.
String getDocumentId()
Document Id of the managed document.
String getJwt()
JWT used to authenticate access to the document.
String getLayerName()
Name of the managed document layer.
String getUserId()
Id of the user the layer managed by the handle belongs to.
boolean isDownloaded()
Check whether document is already downloaded.
InstantPdfDocument openDocument(String jwt)
Downloads and opens document from instant server (synchronously).
Single<InstantPdfDocument> openDocumentAsync(String jwt)
Downloads and opens document from instant server asynchronously.
void removeLocalStorage()
Removes local storage for this layer.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public synchronized Flowable<InstantProgress> downloadDocumentAsync (String jwt)

Downloads document from instant server asynchronously.

Scheduler:
downloadDocumentAsync does not operate by default on a particular Scheduler.

Parameters
jwt JWT used to authenticate access to the document.
Returns
  • Flowable chain emitting download progress updates.

public String getCreatorName ()

Returns the creator name set in the JWT — if any.

The JWTs issued by your backend server may define a name that should be attached to all annotations created by the bearer of this token under the (optional) key creator_name. In contrast to the user_id, which uniquely identifies the bearer of the JWT as a specific user, and is likely to contain numbers etc. for disambiguation, the creator_name is meant to be human readable. In effect, it is perfectly acceptable for two users (as distinguished by their user_id) to have the same creator name.

Returns
  • The contents of the optional creator_name claim in the JWT.

public String getDocumentId ()

Document Id of the managed document.

Returns
  • String identifier uniquely identifying this document on the Instant server.

public String getJwt ()

JWT used to authenticate access to the document.

Returns
  • Currently used JWT for authenticating access to the document.

public String getLayerName ()

Name of the managed document layer.

Returns
  • String identifier identifying document layer.

public String getUserId ()

Id of the user the layer managed by the handle belongs to.

May be null for document descriptors that have been instantiated via the legacy API, or with a JWT that does not contain the `user_id` claim.

public boolean isDownloaded ()

Check whether document is already downloaded.

public InstantPdfDocument openDocument (String jwt)

Downloads and opens document from instant server (synchronously).

Parameters
jwt JWT used to authenticate access to the document.
Returns
  • Single returning opened InstantPdfDocument or error when document could not be downloaded or opened.

public Single<InstantPdfDocument> openDocumentAsync (String jwt)

Downloads and opens document from instant server asynchronously.

Scheduler:
openDocumentAsync does not operate by default on a particular Scheduler.

Parameters
jwt JWT used to authenticate access to the document.
Returns
  • Single returning opened InstantPdfDocument or error when document could not be downloaded or opened.

public void removeLocalStorage ()

Removes local storage for this layer. Document will be invalid after returning from this method.