Frameworks
React Native
Flutter
Package samples
Cookbook
Version 11
Version 10
Version 9
Version 8
Version 7
Version 6
Version 5
This section will show you how to open a document in a DocumentActivity
. This is an AppCompatActivity which contains a PdfViewCtrlTabHostFragment2
and packages all the standard features used during document viewing. You can learn more in our document viewer overview.
AndroidManifest.xml
file needs to be updated to request permissions to allow DocumentActivity
to function properly. You also need to add some attributes to the <application>
tag as well as a new <activity>
tag to define the DocumentActivity
.Read more: detailed description of permission requirements.Please follow the latest Android best practices and guidelines.
onCreate
method for your MainActivity
class, add the following lines to open a demo pdf from URL.You can open documents using DocumentActivity
in many ways.If you require more customizability options, please use PdfViewCtrlTabHostFragment2
since it gives you full control over UI and behavior customization. Read more on the different components in the viewer overview guide for Andriod .
Your app should look something like this:
You can explore the features of the viewer and also many customization options.
DocumentActivity
can open documents from various resources including internal storage, URIs, web servers and the application's res
folder.
You can open files from the these sources using the code below:
If you did not request Storage permission, the app sandbox is recommended for cache path, otherwise you have control over where you would like to store the cache file.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales