Some test text!

Search
Hamburger Icon

Android / Guides / Create a thumbnail

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:

pdfViewCtrl.addThumbAsyncListener(new PDFViewCtrl.ThumbAsyncListener() {
    @Override
    public void onThumbReceived(int page, int[] buf, int width, int height) {
        try {
            Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
            bitmap.setPixels(buf, 0, width, 0, 0, width, height);
            // use the bitmap 
        } catch (OutOfMemoryError oom) {
            // error
        }
  }
});

// request thumbnail for page 3
pdfViewCtrl.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().

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales