PSPDFKit Instant Usage
The entry class into Instant is InstantClient
. This represents a connection to your Document Engine. An app typically creates one InstantClient
, although it could create several to connect to multiple PSPDFKit Server instances.
Instant manages downloading and storing PDF files when your app requests this. Each PDF file managed by Instant is identified by its identifier
and can have one or more named layers. Each layer represents a separate set of annotations displayed on top of the base file and is uniquely identified by the combination of identifier
and layerName
.
The API to each layer managed by Instant is InstantDocumentDescriptor
. A document descriptor may be used to request downloading the associated PDF file and annotations by calling download(usingJWT:)
with an appropriate JSON Web Token (JWT). It can also be used to create a Document
. Set this document on an InstantViewController
and then show it to the user. The view controller will show a download progress bar and then refresh to display the PDF when the download completes. Changes to annotations in the Document
will be seen by all users viewing the same layer.
InstantViewController
is a subclass of PDFViewController
and may be used to show any Document
— not just those created by Instant. However, there won’t be any annotation synchronization for documents that weren’t created by Instant. This means it’s possible to create a PDFTabbedViewController
whose internal pdfController
is an InstantViewController
. You can also mix documents managed by Instant with other documents in the tabbed bar. Showing a Document
created by an InstantDocumentDescriptor
in any PDFViewController
except an InstantViewController
isn’t supported.