ImageSelection


public final class ImageSelection implements 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 methods

void
boolean
equals(Object other)
final @NonNull 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.

@NonNull List<@NonNull PdfRect>

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

int

Public methods

close

Added in 1.0.0-alpha13
public void close()

equals

public boolean equals(Object other)

getBitmap

Added in 1.0.0-alpha13
public final @NonNull Bitmap getBitmap()

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.

getBounds

public @NonNull List<@NonNull PdfRectgetBounds()

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.

hashCode

public int hashCode()