Try the PDFTron demo in your application

This tutorial only applies to Xamarin.Android.

Supporting Sdk versions:

  • Minimum: API 16 (Using Android Support Libraries)
  • Target: API 27

To try the PDFTron demo Activity in one of your own projects, here are a few simple steps to prepare your Visual Studio project.

First, make sure your project targets 8.0:

Open the NuGet package manager by right click on your project, and click Manage NuGet Packages.... Then in Browse tab, search for PDFTron.


Then, turn on Multi-Dex:

Next, add permissions to AndroidManifest.xml file outside of the <application> tag:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

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


<activity android:name=""

Finally, add style to Resources/values/styles.xml:

    <style name="CustomAppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
        <item name="colorPrimary">@color/app_color_primary_day</item>
        <item name="colorPrimaryDark">@color/app_color_primary_dark_day</item>
        <item name="colorAccent">@color/app_color_accent</item>
        <!-- Drawer -->
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
        <!-- Action bar -->
        <item name="actionModeBackground">?attr/colorPrimary</item>
        <item name="windowActionModeOverlay">true</item>
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 Simple Reader demo, use:


You will see:

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

To open your own file in Simple Reader demo, use:

// from internal storage
var localFile = Android.Net.Uri.FromFile(new Java.IO.File("myLocalFilePath"));
pdftron.Demo.App.SimpleReaderActivity.OpenDocument(this, localFile);

// from content uri
var contentUri = Android.Net.Uri.Parse("myContentUri");
pdftron.Demo.App.SimpleReaderActivity.OpenDocument(this, contentUri);

// from http/https
var fileLink = Android.Net.Uri.Parse("myFileLink");
pdftron.Demo.App.SimpleReaderActivity.OpenDocument(this, fileLink);

// from res
pdftron.Demo.App.SimpleReaderActivity.OpenDocument(this, Resource.Raw.my_file_res_id);