PdfView.OnViewportChangedListener


public interface PdfView.OnViewportChangedListener


Listener interface to receive changes to the viewport, i.e. the window of visible PDF content

Summary

Public methods

abstract void
onViewportChanged(
    int firstVisiblePage,
    int visiblePagesCount,
    @NonNull SparseArray<@NonNull RectF> pageLocations,
    float zoomLevel
)

Called when there has been a change in visible PDF content

Public methods

onViewportChanged

Added in 1.0.0-alpha10
abstract void onViewportChanged(
    int firstVisiblePage,
    int visiblePagesCount,
    @NonNull SparseArray<@NonNull RectF> pageLocations,
    float zoomLevel
)

Called when there has been a change in visible PDF content

Parameters
int firstVisiblePage

the first page that's visible in the View, even if partially so

int visiblePagesCount

the number of pages that are visible in the View, including partially visible pages

@NonNull SparseArray<@NonNull RectF> pageLocations

the location of each page in View coordinates. At extremely low zoom levels, only the first 100 page locations will be provided, and the rest can be obtained from pdfToViewPoint. Rect instances are recycled; make a copy of any you wish to make use of beyond the scope of this method.

float zoomLevel

the current zoom level