Thumbnail browser

You can get previews of a document's pages.

Manipulate pages with thumbnail browser in Xamarin.Android

This tutorial only applies to Xamarin.Android. See Xamarin.iOS equivalent here.

The ThumbnailsViewFragment class allows users to manipuate pages of a document including add, remove, re-arrange, rotate and duplicate pages. Users are also able to undo/redo page manipulations.

Host Fragment

Show page thumbnails dialog

To show a page thumbnails dialog in your activity, create a new instance of ThumbnailsViewFragment by calling newInstance() and setting the PDFViewCtrl:

C#

1var thumbDialog = ThumbnailsViewFragment.NewInstance();
2thumbDialog.SetPdfViewCtrl(mPdfViewCtrl);
3thumbDialog.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
4thumbDialog.Show(this.SupportFragmentManager, "thumbnails_dialog");

If you want to specify that the document is read-only you can use newInstance(boolean):

C#

1var thumbDialog = ThumbnailsViewFragment.NewInstance(true);

Export pages

If you would like to allow users to export a subset of pages from the document, you should implement OnExportThumbnailsListener interface by providing implementation for exporting pages:

C#

1thumbDialog.ExportThumbnails += (sender, e) =>
2{
3 // Implementation for exporting given pages.
4};

If you set OnExportThumbnailsListener, the "Export" menu item will show up in the overflow menu when at least one page is selected.

Export

Dialog callbacks

If you want to be notified when the thumbnails view dialog fragment is dismissed, implement OnThumbnailsViewDialogDismissListener interface. Also, if you want to be notified when the user attempts to edit pages while the document is read only you should implement OnThumbnailsEditAttemptWhileReadOnlyListener interface:

C#

1thumbDialog.ThumbnailsViewDialogDismiss += (sender, e) =>
2{
3 // Handle viewer when the thumbnails view dialog is dismissed.
4};
5thumbDialog.ThumbnailsEditAttemptWhileReadOnly += (sender, e) =>
6{
7 // Show message when user attempts to edit pages of a read only document.
8};

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales