Working with Multiple Documents
PSPDFKit for Android supports loading multiple documents into a single
PdfActivity. This guide will outline how to launch the
PdfActivity, as well as how to control which documents are displayed.
Depending on how many documents you want to display in the
PdfActivity, there are different ways to do it.
Displaying One Document
If you’re just displaying a single document, the
PdfActivity itself has a convenient method to do this:
Displaying Multiple Documents
If you need to display two or more documents in a
PdfActivity, you’ll have to use the
PdfActivity without Documents
Finally, you can also start the
PdfActivity without any document at all using
Managing Displayed Documents
Once you start the
PdfActivity, you can manage the displayed documents by using the
DocumentCoordinator. To obtain an instance, use
PdfActivity#getDocumentCoordinator(). To see an example of how this can be used, check out
DocumentTabsExample in our Catalog app:
UI for Handling Multiple Documents
By default, PSPDFKit provides a tabbed user interface to allow the user to switch between all the currently opened documents.
You can also build an entirely custom UI to switch between documents using the
DocumentCoordinator as shown in
DocumentSwitcherExample found in the Catalog app.