Some test text!

keyboard_arrow_down

Get started

Quick start - view a documentDownload PDFTron SDKIntegrate with GradleIntegrate manuallyAdd license keyPermissionsRun samplesUpdate to latest versionTroubleshooting
keyboard_arrow_down

Fundamentals

Document lockingDocument saving
keyboard_arrow_down

Document Viewer

OverviewShow a document in an ActivityShow a document in a FragmentViewer configurationToolManager configurationDay and Night themesOpen from online URL
keyboard_arrow_down

Document Viewer components

OverviewPDFViewCtrlReflowQuick menuCustomize quick menuAnnotation toolbarAnnotation style editorCustomize annotation style editorPage sliderList containerAnnotation listDocument outlineUser bookmark listThumbnail browserAdd pages dialogCrop pages dialogRotate pages dialogView mode dialog
keyboard_arrow_down

Annotation and collaboration

OverviewRead only modeDisable annotation creation and editingDefault annotation propertiesChange tool modeEventsOverride annotation handlingShow and hide existing annotationsUndo and redoRealtime collaborationTool class hierarchy
keyboard_arrow_down

Advanced customization

OverviewAdd a custom view to a pageCreate a custom toolPage color modePage fit modePage layout modeScrolling directionRight-to-left support
keyboard_arrow_down

Conversion

Convert documents to PDFConvert HTML to PDF
keyboard_arrow_down

Parsing and extraction

keyboard_arrow_down

Digital signatures

keyboard_arrow_down

Form filling

keyboard_arrow_down

Search

Text search
keyboard_arrow_down

Redaction

keyboard_arrow_down

Advanced topics

PrintUnderstand coordinatesGenerate page thumbnailsChange annotation propertiesDelete annotations
keyboard_arrow_down

Other frameworks

keyboard_arrow_down

Reference

ProGuardLocalizationIcon cheat sheet
keyboard_arrow_down

PDF Processing API

Convert documents to PDFkeyboard_arrow_down

Convert documents to PDF

In this document
chevron_rightView a document
chevron_rightOption 1: from local device storage
chevron_rightOption 2: from content uri
Conversion requires full version of PDFTron library. See PDFTron full or standard?
If you are already using any of DocumentActivity or PdfViewCtrlTabHostFragment, you will not need to go through this article as viewing of other document types is already taken care of internally. Continue reading this article if you are not planning to use any of the above.
Saving annotations back to non-PDF formats is not supported. You can instead save the annotated PDFDoc to a PDF file.

PDFViewCtrl has a powerful and seamless conversion system which allows you to stream documents during conversion to PDF. It supports the following file types:

  • Office file conversion: .docx, .pptx, .xlsx, .doc. (with the office conversion Add-On module)
  • Image conversion: .bmp, .jpg, .tif, .png, .gif
  • Image collections (zip archives with any type of image listed above)
  • Markdown: .md

In this tutorial you will be able to display a non-PDF file in PDFViewCtrl.

Before going forward, please make sure you have finished setting up PDFViewCtrl as described in Using PDFViewCtrl.

linkView a document

The easiest way to display a non-PDF file in PDFViewCtrl is through the PDFViewCtrl.openNonPDFUri API.

linkOption 1: from local device storage

To access device storage, add the following permissions to AndroidManifest.xml file in the <manifest> tag (outside of the <application> tag):

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

Then add the following when you would like to show the document, typically onCreate or onResume of your Activity or Fragment:

linkOption 2: from content uri

Add the following when you would like to show the document, typically onCreate or onResume of your Activity or Fragment:

To monitor the conversion event, do: