Some test text!

keyboard_arrow_down

Get started

Download PDFTron SDKIntegrate with GradleIntegrate manuallyRun samplesAdd license keyQuick start - view a documentProGuardUpdate to latest versionTroubleshooting
keyboard_arrow_down

Document Viewer

keyboard_arrow_down

Document Viewer components

PDFViewCtrlReflowFloating context menuCustomize floating context menuAnnotation toolbarAnnotation style editorCustomize annotation style editorPage sliderAnnotation listDocument outlineUser bookmark listList containerThumbnail browserAdd pages dialogRotate pages dialogView mode dialogCrop pages dialog
keyboard_arrow_down

Annotation and collaboration

OverviewRead only modeDisable annotation creation/editingDefault annotation propertiesAnnotation propertiesEventsOverride annotation handlingShow and hide existing annotationsUndo and redoRealtime collaboration
keyboard_arrow_down

Advanced customization

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

Conversion

Convert documents to PDFConvert HTML to PDF
keyboard_arrow_down

Search

Text search
keyboard_arrow_down

Other Frameworks

keyboard_arrow_down

Advanced topics

Understand coordinatesDocument savingDocument lockingGenerate page thumbnailsTool class hierarchy
keyboard_arrow_down

FAQ

System RequirementsRun project in Android StudioRun project with source codePDFTron full vs. standardLocalizationIcon cheat sheetReduce size of APKEnable multidexOut of memory when rotating device multiple timesReduce memory consumptionDetachCurrentThread warning
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
Crop pages dialogkeyboard_arrow_down

Crop pages dialog

In this document
chevron_rightShowing user crop pages dialog
chevron_rightCropping pages automatically
chevron_rightRemoving user crop boxes
chevron_rightPermanently cropping pages

With PDFTron library, you can crop pages manually or automatically, as well as reset pages to their original size. The UserCropDialogFragment class shows a dialog for users to adjust the page's crop box. The user can also apply the current page's crop box to a subset of pages or even to all pages in the document.

linkShowing user crop pages dialog

To create a new instance of the user crop pages dialog fragment, call newInstance() and set the PDFViewCtrl:



To apply the crop box, make sure you have Page.e_user_crop as the default page box:



You can also set a listener via setOnUserCropDialogDismissListener(OnUserCropDialogDismissListener) to be notified when the user crop dialog is dismissed.

UserCropDialogFragment does not crop pages permanently, it may not handled well by other PDF viewer. To crop pages permanently, see cropping pages permanently

linkCropping pages automatically

To crop pages automatically, you can simply use the utility API called UserCropUtilities.AutoCropInBackgroundTask. It crops the edges of the document based on the position of the content.

linkExample


linkRemoving user crop boxes

If, after cropping pages, you wish to reset page size, you can use the utility function UserCropUtilities.removeUserCropFromPage(Page).

linkPermanently cropping pages

Cropping pages through above methods are in user-level. User-level page-cropping may not be handled well by other PDF viewers. To apply crop pages permanently use UserCropUtilities.cropDoc(PDFDoc).