Some test text!

Getting started

Running samplesTry demo in your projectDownloading PDFTronIntegrating PDFTron via GradleManually integrating PDFTronUpgradingAdding PDFTron license keyUsing ProGuardTroubleshooting integration


Document lockingSaving PDF documentsUnderstanding coordinates


Using an ActivityUsing a FragmentUsing PDFViewCtrlViewer configConverting and viewing other document typesConverting HTML to PDF


PDFViewCtrl color modesPDFViewCtrl page view modePDFViewCtrl page presentation modeGenerating thumbnails in PDF


Day/Night themesUndo and redoText searchAnnotation syncingRotating PDF pagesPDFViewCtrl read onlyUsing PDFViewCtrl with minimum memory


Tools overviewSetting Up ToolManagerChanging and disabling toolsIntercepting annotation handlingToolManager eventsDefault annotation propertiesTool subclasses


Deleting annotationsAnnotation styleShow/hide annotations

UI components

Quick menuAnnotation toolbarAnnotation style dialogThumbnail sliderAnnotations listOutline listUser bookmarks listBookmarks dialogPage thumbnails dialogAdd page dialogRotate pages dialogView mode dialogCrop page dialogReflow


Adding a custom view to a PDF pageCustom toolCustomizing quick menuCustomizing annotation style dialog


Running project in Android StudioSystem RequirementsPDFTron full vs. standardLocalizationIcon cheat sheetRunning sample with sourceReducing size of APKEnable multidexOut of memory when rotating device multiple timesDetachCurrentThread warning

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


In this document
chevron_rightShowing reflow pager
chevron_rightPost-processing color
chevron_rightNotifying the reflow pager that the document has been modified
chevron_rightSetting the text size
chevron_rightSetting background color
chevron_rightSetting right-to-left direction
chevron_rightGenerating a reflow page
Reflow requires the full version of PDFTron library. See PDFTron full or standard?

Reflow makes the document more flexible and easier to read, especially on small devices. PDFTron is able to extract the reflowable layout of each page of a PDF document as an HTML file. First, we explain how simple it is to show a widget that allows the user to swipe left or right through the pages of the document to see reflowable document pages. Then, we provide the methods necessary for converting a hard-layout PDF page to an HTML document page.

linkShowing reflow pager

ReflowControl is a ViewPager that allows the user to flip left and right through the reflowable layout of pages in a certain PDF document.


To set up your layout with ReflowControl, add a <ReflowControl> element to your XML layout. For example, if each page in the swipe view should consume the entire layout, then your layout looks like this:

    android:layout_height="match_parent" />

Then, you need to attach a PDFDoc to the reflow pager:

That is everything you need to have a simple reflow pager. Next, we will go through advanced features.

linkPost-processing color

If you want to map each original color to a new color (for example for handling night mode) you need to pass an OnPostProcessColorListener listener to the ReflowControl.

To do so, you can provide an OnPostProcessColorListener listener when setting up the ReflowControl:

For example, OnPostProcessColorListener can be defined by PDFViewCtrl as:

Alternatively you can set a listener:

linkNotifying the reflow pager that the document has been modified

To refresh the reflow pager to show the latest changes on your document, you should let the reflow pager know that the document has been modified:

linkSetting the text size

It is possible to change the size of reflowable text. The default text size is 100; valid values are 5, 10, 25, 50, 75, 100, 125, 150, 200, 400, 800, and 1600. See the following code as an example

Alternatively, you can zoom in/out to change the reflowable text size:

Assuming the current text size is 100%, by calling zoomReflow(reflowControl, true) and zoomReflow(reflowControl, false) the new text size will be 125% and 75% of the original size, respectively.

linkSetting background color

There are three methods to change the background color:

setDayMode(): no background

setNightMode(): night background

setCustomColorMode(int): customized background

linkSetting right-to-left direction

You can support right-to-left languages by setting the direction of reflowable text by calling setRightToLeftDirection(isRtlMode)

linkGenerating a reflow page

It is not necessary to use a reflow pager to create a reflowable layout of PDF pages. It is also possible to extract the reflowable layout by creating an HTML file from a certain page of the document using the ReflowProcessor class. The first step is to let the Core know you are going to use reflow by calling initialize(). Please note that this method clears all existing reflowable data. Thus, preferably put this call in your Application or Activity.

When reflow processor has been initialized, it is possible to turn reflow on by calling getReflow(Page, RequestHandler, Object) and passing a RequestHandler callback in order to be notified once the reflowable HTML file is ready::

To cancel all reflow requests, call cancelAllRequests().

Finally, if you want to clear all HTML files created in the cache, you may need to call clearCache().