Save PDFs to Document Engine on Android
Document Engine is our server-side component that stores documents and annotations. PSPDFKit Instant connects to Document Engine and seamlessly takes care of downloading documents and synchronizing annotations. With Instant, it’s easy add real-time collaboration features to your PSPDFKit-powered Android app, allowing your users to share and annotate PDF documents across Android, iOS, and Web apps.
By default, PSPDFKit Instant synchronizes annotations with your Document Engine in real time. Your app doesn’t need to do anything to save changes: It’s all taken care of. You can also configure Instant to sync manually when your app requests this. Thanks to this automatic syncing of annotations, it’s easy to set up collaborative workflows using Instant.
Instant layers can be used to model separate sets of annotations on a document. For example, if you use Instant as part of an education platform, you may have a document that’s part of an assignment, where each student should add their own answers to the assignment without seeing the answers from any other student. In this case, you’d create one Instant Layer in the document for each student.
Instant supports offline editing for situations where a network connection isn’t accessible. Changes will be synchronized the next time a connection is available.
Uploading a File to Document Engine from the Client
If your app has a file stored locally on an end user’s device, you can move that document so it’s managed by Document Engine like this:
-
Your app uploads the file to your backend.
-
Your backend forwards the uploaded file to Document Engine. In return, it receives a document identifier. On your server, you only have to store the identifier; we store the PDF document, its annotations, and the meta information.
-
Your backend returns a JWT to your app, which grants permission to access the document with this identifier.
-
Your app uses PSPDFKit Instant to download the document using the obtained JWT.
The document is now managed by Document Engine and Instant and supports real-time collaboration. The original file is no longer needed.
For more details, please see the documentation for Document Engine — in particular, the server API for uploading a document.