Some test text!

keyboard_arrow_down

Get started

Download PDFTron SDK
play_arrow

Quick start - view a document

Integrate with NuGetIntegrate manuallyRun samplesAdd license keyUpdate to latest version
keyboard_arrow_down

Xamarin.Forms

keyboard_arrow_down

Fundamentals

keyboard_arrow_down

FAQ

System requirementsPDFTron full vs. standardReduce size of APK
keyboard_arrow_down

Document Viewer

play_arrow

Xamarin.Android

OverviewShow a document in an ActivityShow a document in a FragmentViewer configurationToolManager configurationDay and Night themes
play_arrow

Xamarin.iOS

Open from online URL
keyboard_arrow_down

Document Viewer components

Overview
play_arrow

PDFViewCtrl

play_arrow

Reflow

Quick menuCustomize quick menu
play_arrow

Annotation toolbar

play_arrow

Annotation style editor

play_arrow

Page slider

play_arrow

List container

Xamarin.AndroidXamarin.iOS
play_arrow

Annotation list

play_arrow

Document outline

play_arrow

User bookmark list

play_arrow

Thumbnail browser

Add pages dialogCrop pages dialogRotate pages dialogView mode dialog
keyboard_arrow_down

Annotation and collaboration

OverviewToolManager setupRead only mode
play_arrow

Disable annotation creation and editing

play_arrow

Default annotation properties

play_arrow

Change tool mode

play_arrow

Events

play_arrow

Override annotation handling

Show and hide existing annotationsRealtime collaboration
keyboard_arrow_down

Advanced customization

play_arrow

Add a custom view to a page

Create a custom toolPage coloring modePage fit modePage layout modeScrolling direction
keyboard_arrow_down

Conversion

play_arrow

Convert documents to PDF

Xamarin.AndroidXamarin.iOS
play_arrow

Convert HTML to PDF

Xamarin.AndroidXamarin.iOS
keyboard_arrow_down

Parsing and extraction

keyboard_arrow_down

Digital signatures

keyboard_arrow_down

Search

play_arrow

Text search

Xamarin.AndroidXamarin.iOS
keyboard_arrow_down

Advanced topics

PrintUnderstand coordinatesGenerate page thumbnails
keyboard_arrow_down

Troubleshooting

Reduce memory consumption
keyboard_arrow_down

Reference

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
Reduce memory consumptionkeyboard_arrow_down

Reduce memory consumption

In this document
chevron_rightChange render cache size
chevron_rightPrevent out of memory when rotating device
chevron_rightIncrease Android heap size
This tutorial only applies to Xamarin.Android.

linkChange render cache size

In order to achieve smoother viewing experience, PDFViewCtrl keeps certain amount of invisible content. However, keeping invisible content increases memory usage. Android sets an upper bound on the VM heap size allowed for an app. By default, PDFViewCtrl is set to use a quarter of maximum VM heap size for keeping visible and invisible content. Based on the memory footprint of your app, you may want to customize it.

To customize the memory usage:

where pdfViewCtrl is an instance of PDFViewCtrl.

If you want to minimize the heap memory usage at the cost of viewing experience quality, you can set allowed_max to 0. PDFViewCtrl will not keep any invisible content.
setRenderedContentCacheSize(long) only controls the memory usage of VM heap size by PDFViewCtrl, but not the native memory that PDFViewCtrl might use.

linkPrevent out of memory when rotating device

Question:

We are experiencing a lot of out of memory errors when rotating the device multiple times. Since the Activity is destroyed while rotating, we get a new (quite heavy) PDFViewCtrl every time we rotate the device.

Answer:

PDFViewCtrl can handle rotation properly, it is recommended that you configure your activity to handle configuration changes. This way the view will not be recreated and it will be resized accordingly.

  1. In your app AndroidManifest.xml file, add android:configChanges to your activity tag.

    <activity
        android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
        >
      </activity>
  2. Override onConfigurationChanged() in your activity:

    where mPdfViewCtrl is an instance of PDFViewCtrl.

linkIncrease Android heap size

On Android 3.0 and above, you can also increase the allowed heap size of an app.

In your app AndroidManifest.xml file, add the android:largeHeap="true" attribute to the <application> tag:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  >
  <application
    android:largeHeap="true"
    >
  </application>

</manifest>