Some test text!

keyboard_arrow_down

Get started

Download PDFTron SDKIntegrate with NuGetIntegrate manuallyRun samplesAdd license keyQuick start - view a documentUpdate to latest version
keyboard_arrow_down

Xamarin.Forms

Basic viewer
keyboard_arrow_down

Fundamentals

Java binding (Android)Objective-C binding (iOS)Code sharing
keyboard_arrow_down

Document Viewer

play_arrow

Xamarin.Android

play_arrow

Xamarin.iOS

Open from online URL
keyboard_arrow_down

Document Viewer components

play_arrow

PDFViewCtrl

ReflowAnnotation toolbarAnnotation style editorPage sliderAnnotation listDocument outlineUser bookmark listList containerThumbnail browserAdd pages dialogRotate pages dialogView mode dialogCrop pages dialog
keyboard_arrow_down

Annotation and collaboration

OverviewToolManager setupDisable annotation creation/editingOverride annotation handling
keyboard_arrow_down

Advanced customization

Add a custom view to a pageCreate a custom toolPage coloring modePage fit modePage layout modeRealtime collaboration
keyboard_arrow_down

Conversion

Convert documents to PDFConvert HTML to PDF
keyboard_arrow_down

Search

Inline text search
keyboard_arrow_down

Advanced topics

Document savingDocument locking
keyboard_arrow_down

FAQ

System RequirementsPDFTron full vs. standardBuild split APKsLocalizationIcon cheat sheet
keyboard_arrow_down

PDF Processing API

What is PDFNet?Opening a documentSerializing (saving) a documentWorking with pagesWorking with Page ContentWorking with BookmarksWorking with Interactive Forms (AcroForms)PDF SecurityLow-level PDF APIError handling

Show a document in an Activity

This article only applies to Xamarin.Android.
DocumentActivity requires the full version of PDFTron library. See PDFTron full or standard?

PDFTron ships with DocumentActivity which is an all-in-one document reader and PDF editor. In addition to PDF files, it also supports viewing of other file extensions such as .docx, .doc, .pptx, .xlsx, .md, .cbz and various image formats. It allows stream conversion of these non-pdf documents to PDF format so you can view the document while conversion happens. In this activity, you can read, annotate, sign, fill in PDF forms and more. See detailed features list here.

DocumentActivity extends Android's AppCompatActivity and follows Material design guidelines.

Please note that DocumentActivity requires the PDFTron.Android.Tools NuGet package.

Here are a few simple steps to get started with DocumentActivity.

  1. First, add activity declarations to AndroidManifest.xml file:

    <application
        ...
        android:supportsRtl="true"
        android:largeHeap="true">
        ...
        <activity android:name="com.pdftron.pdf.controls.DocumentActivity"
            android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
            android:windowSoftInputMode="adjustPan"
            android:theme="@style/CustomAppTheme"/>
    </application>
  2. Then, add theme to res/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>
        <!-- Action bar -->
        <item name="actionModeBackground">?attr/colorPrimary</item>
        <item name="windowActionModeOverlay">true</item>
    </style>

    Alternatively, if you cannot use NoActionBar as a base theme:

    DocumentActivity extends AppCompatActivity and uses AppCompat Toolbar. It is important that you define a Theme.AppCompat-based theme. The recommended theme is Theme.AppCompat.*.NoActionBar. Other custom themese can also be used however, be sure to disable the action bar manually:

    <style name="CustomAppTheme" parent="Theme.AppCompat.*">
        ...
        <!-- Action bar -->
        <item name="windowActionModeOverlay">true</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
  3. Then, if you would like to customize the UI of DocumentActivity, you can use ViewerConfig builder. For example:

    
    
    
    
    
    

    For details on customizing the UI interface and sample usage of ViewerConfig builder, check out the configuration tutorial.

  4. If you need storage permission for accessing local documents, add the following permission to AndroidManifest.xml file outside of the <application> tag:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    Storage permission
    Please note that from Android 6.0, API 23, and up, application needs to request storage permission at runtime before accessing any files on device.
  5. If you need internet permission for downloading online documents, add the following permission to AndroidManifest.xml file outside of the <application> tag:

    <uses-permission android:name="android.permission.INTERNET"/>
  6. If you have sound annotation creation tool enabled, add the following permission to AndroidManifest.xml file outside of the <application> tag:

    <uses-permission android:name="android.permission.RECORD_AUDIO" />
  7. Lastly, launch the activity from anywhere in your application: