ImageSelection


class ImageSelection : Selection, AutoCloseable


Represents a specific image object selected from a PDF document.

The ImageSelection is delivered to the application if PdfView.isImageSelectionEnabled is enabled, via the PdfView.OnSelectionChangedListener. It can then be used to implement features like image sharing or copying. The bounds can be passed to PdfView.setHighlights to visually highlight the selected image, while the bitmap can be used for copying or sharing.

Memory Management

As this class holds a Bitmap, it implements AutoCloseable. It is mandatory to call close when the object is no longer needed to recycle the bitmap and avoid memory leaks. Using a try-with-resources statement (or the use extension function in Kotlin) is recommended for safe handling.

Summary

Public functions

open Unit
open operator Boolean
equals(other: Any?)
open Int

Public properties

Bitmap

This object captures the entire Bitmap of image located at the top of the Z-axis (the visually topmost image) at the interaction point.

open List<PdfRect>

A list containing a single PdfRect that defines the page number and the bounding box of the image in PDF points.

Public functions

close

Added in 1.0.0-alpha13
open fun close(): Unit

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

Public properties

bitmap

Added in 1.0.0-alpha13
val bitmapBitmap

This object captures the entire Bitmap of image located at the top of the Z-axis (the visually topmost image) at the interaction point. This is the raw image data and not a "flattened" screenshot; the bitmap contains only the data for that specific image object and excludes overlapping text, vector graphics, or background content.

bounds

open val boundsList<PdfRect>

A list containing a single PdfRect that defines the page number and the bounding box of the image in PDF points. These bounds represent the image's layout position and scale on the page.