Crop a page (Android)

There are two options to crop a page. First is using a UI component that can crop or reset pages. Second is an API guide to programmatically crop a page.

Crop document pages in Android

This tutorial only applies to Xamarin.Android.

With the Apryse library you can crop pages manually or automatically, as well as reset document pages to their original size. The UserCropDialogFragment allows a user to adjust the page's crop box which can then be applied to a subset of pages or to all the pages in a document.

Apryse Docs Image

Show user crop pages dialog

To show a user crop pages dialog in your activity, create a new instance of UserCropDialogFragment by calling newInstance() and setting the PDFViewCtrl:

C#

1public void ShowUserCropDialog()
2{
3 var userCropDialogFragment = pdftron.PDF.Controls.UserCropDialogFragment.NewInstance()
4 .SetPdfViewCtrl(mPdfViewCtrl);
5 userCropDialogFragment.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
6 userCropDialogFragment.Show(this.SupportFragmentManager, "user_crop_pages_dialog");
7}

In order to view user cropped pages in PDFViewCtrl make sure you set Page.e_user_crop as the default page box:

C#

1mPdfViewCtrl.SetPageBox(pdftron.PDF.Page.Box.e_user_crop);

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales