For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quick start: viewing a document in Xamarin.Android

This tutorial only applies to Xamarin.Android.

See Xamarin.iOS equivalent here .

Supporting Sdk versions:

  • Minimum: API 16 (Using Android Support Libraries)

  • Recommended target: API 35

This guide demonstrates how to display a PDF. To begin working with Apryse SDK, you must have first added it to your project, and initialized the library.

First make sure the following is in your <application> tag in AndroidManifest.xml.

<application ... android:largeHeap="true" android:usesCleartextTraffic="false">
    
    <activity android:name="com.pdftron.pdf.controls.DocumentActivity" android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize" android:windowSoftInputMode="adjustPan" android:theme="@style/PDFTronAppTheme"/>
</application>

Next, add permissions to AndroidManifest.xml file in the <manifest> tag (outside the <application> tag):

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Permission
Purpose

android.permission.INTERNET

Internet permission for downloading online documents

android.permission.RECORD_AUDIO

Audio recording permission for creating sound annotations

Add license key and activity declarations to AndroidManifest.xml file inside the <application> tag:

Finally, if you would like to customize the appearance of the viewer activity, define PDFTronAppTheme in Resources/values/styles.xml:

If you are using your own theme, please don't forget to add/change the theme tag of your AndroidManifest file's corresponding activity declaration.

To open a PDF file:

You will see:

Please note that changes for files opened from res will not be saved on disk.

To open your own file in DocumentActivity, use:

Last updated

Was this helpful?