generateThumbnail

suspend fun generateThumbnail(context: Context, source: Any, pageIndex: Int = 0, config: ThumbnailConfig = ThumbnailConfig(), password: String? = null, useCache: Boolean = true): Bitmap?

Generates a thumbnail for a specific page of a PDF document.

Return

The generated thumbnail bitmap, or null if generation failed.

Parameters

context

The application context.

source

The PDF document source (File, Uri, ByteArray, InputStream, String asset path, or DocumentSource).

pageIndex

The page index to generate thumbnail for (0-based). Default is 0.

config

The thumbnail configuration. Default uses standard 200x200 settings.

password

Optional password for encrypted PDFs.

useCache

Whether to use caching for improved performance. Default is true.