Generate PDF page thumbnails in Android

Apryse's library provides a page thumbnail dialog which shows thumbnails of all PDF document pages. Fore more information, see thumbnail browser .

With PDFViewCtrl, you can get a thumbnail Bitmap image for each page in a PDF document.

The following example request thumbnail for page 3:

1pdfViewCtrl.addThumbAsyncListener(new PDFViewCtrl.ThumbAsyncListener() {
2 @Override
3 public void onThumbReceived(int page, int[] buf, int width, int height) {
4 try {
5 Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
6 bitmap.setPixels(buf, 0, width, 0, 0, width, height);
7 // use the bitmap
8 } catch (OutOfMemoryError oom) {
9 // error
10 }
11 }
12});
13
14// request thumbnail for page 3
15pdfViewCtrl.getThumbAsync(3);

where pdfViewCtrl is an instance of PDFViewCtrl.

It is recommended you cancel all thumbnail requests once they are no longer needed. To cancel all thumbnail request, use PDFViewCtrl.cancelAllThumbRequests().

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales