Class InstantDocumentDescriptor
-
- All Implemented Interfaces:
public final class InstantDocumentDescriptor
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 or downloadDocumentAsync.
-
-
Field Summary
Fields Modifier and Type Field Description public final InternalInstantDocumentDescriptor
internal
-
Method Summary
Modifier and Type Method Description InternalInstantDocumentDescriptor
getInternal()
Returns internal descriptor implementation. String
getDocumentId()
Document Id of the managed document. String
getLayerName()
Name of the managed document layer. String
getUserId()
Id of the user the layer managed by the handle belongs to. String
getJwt()
JWT used to authenticate access to the document. boolean
isDownloaded()
Check whether document is already downloaded. void
removeLocalStorage()
Removes local storage for this layer. synchronized Flowable<InstantProgress>
downloadDocumentAsync(@NonNull() String jwt)
Downloads document from Instant Server (PSPDFKit Document Engine) asynchronously. 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. String
getCreatorName()
Returns the creator name set in the JWT — if any. -
-
Method Detail
-
getInternal
@NonNull() InternalInstantDocumentDescriptor getInternal()
Returns internal descriptor implementation.
-
getDocumentId
@NonNull() String getDocumentId()
Document Id of the managed document.
- Returns:
String identifier uniquely identifying this document on the Instant Server (PSPDFKit Document Engine).
-
getLayerName
@NonNull() String getLayerName()
Name of the managed document layer.
- Returns:
String identifier identifying document layer.
-
getUserId
@Nullable() 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.
-
getJwt
@Nullable() String getJwt()
JWT used to authenticate access to the document.
- Returns:
Currently used JWT for authenticating access to the document.
-
isDownloaded
boolean isDownloaded()
Check whether document is already downloaded.
-
removeLocalStorage
void removeLocalStorage()
Removes local storage for this layer. Document will be invalid after returning from this method.
-
downloadDocumentAsync
@NonNull() synchronized Flowable<InstantProgress> downloadDocumentAsync(@NonNull() String jwt)
Downloads document from Instant Server (PSPDFKit Document Engine) asynchronously.
- Scheduler:
downloadDocumentAsync
does not operate by default on a particular .
- Parameters:
jwt
- JWT used to authenticate access to the document.- Returns:
Flowable chain emitting download progress updates.
-
openDocument
@NonNull() InstantPdfDocument openDocument(@NonNull() String jwt)
Downloads and opens document from Instant Server (PSPDFKit Document Engine) (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.
-
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
- JWT used to authenticate access to the document.- Returns:
Single returning opened InstantPdfDocument or error when document could not be downloaded or opened.
-
getCreatorName
@Nullable() 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 theuser_id
, which uniquely identifies the bearer of the JWT as a specific user, and is likely to contain numbers etc. for disambiguation, thecreator_name
is meant to be human readable. In effect, it is perfectly acceptable for two users (as distinguished by theiruser_id
) to have the same creator name.- Returns:
The contents of the optional
creator_name
claim in the JWT.
-
-
-
-