open class PdfView : View


A View for presenting PDF content, represented by PdfDocument.

This View supports zooming, scrolling, and flinging. Zooming is supported via pinch gesture, quick scale gesture, and double tap to zoom in or snap back to fitting the page width inside its bounds. Zoom can be changed using the zoom property, which is notably distinct from View.getScaleX / View.getScaleY. Scroll position is based on the View.getScrollX / View.getScrollY properties.

Summary

Nested types

Listener interface for handling clicks on links in a PDF document.

Listener interface to receive callbacks when the PdfView starts and stops being affected by an external input like user touch.

Listener interface to receive updates when the currentSelection changes

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

Constants

const Int

The PdfView is not currently being affected by an outside input, e.g. user touch

const Int

The PdfView is currently being affected by an outside input, e.g. user touch

const Int

The PdfView is currently animating to a final position while not under outside control, e.g. settling on a final position following a fling gesture.

Public constructors

PdfView(context: Context, attrs: AttributeSet?, defStyle: Int)

Public functions

Unit

Adds the specified listener to the list of listeners that will be notified of changes in state with respect to this PdfView being affected by an external input, e.g. user touch.

Unit

Adds the specified listener to the list of listeners that will be notified of selection change events.

Unit

Adds the specified listener to the list of listeners that will be notified of viewport change events.

Unit

Clears the current selection, if one exists.

open Unit
open Boolean

Prioritizes standard keyboard shortcuts over accessibility-specific handling of certain keys.

open Boolean
open Boolean
PointF?

Returns the View coordinate location of pdfPoint, or null if that PDF content has not been laid out yet.

Unit

Removes the specified listener from the list of listeners that will be notified of changes in state with respect to this PdfView being affected by an external input, e.g. user touch.

Unit

Removes the specified listener from the list of listeners that will be notified of selection change events.

Unit

Removes the specified listener from the list of listeners that will be notified of viewport change events.

open Unit
scrollBy(x: Int, y: Int)
open Unit
scrollTo(x: Int, y: Int)
Unit
scrollToPage(pageNum: Int)

Scrolls to the 0-indexed pageNum, optionally animating the scroll

Unit

Scrolls to position, optionally animating the scroll

Unit

Applies a set of Highlight to be drawn over this PDF.

Unit

Registers listener as the callback to be invoked when an external link in the PDF is clicked.

PdfPoint?
viewToPdfPoint(viewPoint: PointF)

Returns the PdfPoint corresponding to viewPoint in View coordinates, or null if no PDF content has been laid out at viewPoint

PdfPoint?

Returns the PdfPoint corresponding to (x, y)in View coordinates, or null if no PDF content has been laid out at that point.

Protected functions

open Int
open Int
open Boolean
open Unit
open Unit
open Unit
open Unit
onDraw(canvas: Canvas)
open Unit
onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect?
)
open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)
open Unit
open Parcelable?
open Unit
onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int)
open Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)
open Unit

Public properties

Selection?

The currently selected PDF content, as Selection

Drawable
Int
Drawable
Int
Int

The first page in the viewport, including partially-visible pages.

Int

The current state of the PDF view with respect to external inputs, e.g. user touch.

Float

The maximum scaling factor that can be applied to this View using the zoom property

Float

The minimum scaling factor that can be applied to this View using the zoom property

PdfDocument?

Supply a PdfDocument to process the PDF content for rendering

Int

The number of pages visible in the viewport, including partially visible pages

Float

The zoom level of this view, as a factor of the content's natural size with when 1 pixel is equal to 1 PDF point.

Inherited functions

From android.view.View
open Unit
open Unit
open Unit
open Unit
addFocusables(p0: ArrayList<View>, p1: Int, p2: Int)
open Unit
open Unit
open Unit
open Unit
open Unit
open ViewPropertyAnimator
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Boolean
open Boolean
open Boolean
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Unit
open Unit
Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Int
open Int
open WindowInsets
open Int
open Int
open AccessibilityNodeInfo
open Unit
open Unit

This function is deprecated. Deprecated in Java

open WindowInsets
open Boolean
open Unit
open Unit
open Unit
open Boolean
open Unit
open Unit
open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
dispatchNestedPreScroll(p0: Int, p1: Int, p2: IntArray?, p3: IntArray?)
open Boolean
dispatchNestedScroll(p0: Int, p1: Int, p2: Int, p3: Int, p4: IntArray?)
open Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
dispatchScrollCaptureSearch(
    p0: Rect,
    p1: Point,
    p2: Consumer<ScrollCaptureTarget>
)
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
open Boolean
open Unit
open Unit
open Unit
open Unit
open WindowInsets
open WindowInsetsAnimation.Bounds
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
draw(p0: Canvas)
open Unit
open Unit
open View
OnBackInvokedDispatcher?
T
<T : View> findViewById(p0: Int)
T
<T : View> findViewWithTag(p0: Any)
open Unit
open Boolean

This function is deprecated. Deprecated in Java

open View
open Unit
open Unit
open Boolean
open Unit
generateDisplayHash(
    p0: String,
    p1: Rect?,
    p2: Executor,
    p3: DisplayHashResultCallback
)
open CharSequence
open View.AccessibilityDelegate
open Int
open AccessibilityNodeProvider
open CharSequence?
open Int
open Int
open String?
open String?
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getAlpha()
open Animation
open Matrix?
open IBinder
open IntArray
open MutableMap<IntInt>
open Array<String>?
AutofillId
open Int
open AutofillValue?
open Drawable
open BlendMode?
open ColorStateList?
open PorterDuff.Mode?
open Int
@ViewDebug.ExportedProperty(category = "layout")
getBaseline()
Int
open Float
open Int
open Float
open Rect
open Boolean
Boolean
ContentCaptureSession?
open CharSequence
@ViewDebug.ExportedProperty(category = "accessibility")
getContentDescription()
Int
Context
open ContextMenu.ContextMenuInfo
Boolean
open Display
IntArray
open Bitmap

This function is deprecated. Deprecated in Java

open Bitmap

This function is deprecated. Deprecated in Java

open Int

This function is deprecated. Deprecated in Java

open Int

This function is deprecated. Deprecated in Java

open Unit
open Long
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getElevation()
open Int
open Boolean
open Boolean
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "NOT_FOCUSABLE"), @ViewDebug.IntToString(from = 1, to = "FOCUSABLE"), @ViewDebug.IntToString(from = 16, to = "FOCUSABLE_AUTO")], category = "focus")
getFocusable()
open ArrayList<View>
open Unit
open Drawable
open Int
open BlendMode?
open ColorStateList?
open PorterDuff.Mode?
open Float
Boolean
open Boolean
open Handler
open Float
open Float
open Float
open Float
open Int
open Runnable?
Boolean
Int
@ViewDebug.ExportedProperty(category = "layout")
getHeight()
open Unit
open Int
open Int
open Drawable?
open Drawable?
open Int
open Int
@ViewDebug.ExportedProperty(category = "accessibility", mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "noHideDescendants")])
getImportantForAccessibility()
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "yesExcludeDescendants"), @ViewDebug.IntToString(from = 8, to = "noExcludeDescendants")])
getImportantForAutofill()
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "yesExcludeDescendants"), @ViewDebug.IntToString(from = 8, to = "noExcludeDescendants")])
getImportantForContentCapture()
open Boolean
open KeyEvent.DispatcherState
open Int
@ViewDebug.ExportedProperty(category = "accessibility")
getLabelFor()
open Int
@ViewDebug.ExportedProperty(category = "drawing", mapping = [@ViewDebug.IntToString(from = 0, to = "NONE"), @ViewDebug.IntToString(from = 1, to = "SOFTWARE"), @ViewDebug.IntToString(from = 2, to = "HARDWARE")])
getLayerType()
open Int
@ViewDebug.ExportedProperty(category = "layout", mapping = [@ViewDebug.IntToString(from = 0, to = "RESOLVED_DIRECTION_LTR"), @ViewDebug.IntToString(from = 1, to = "RESOLVED_DIRECTION_RTL")])
getLayoutDirection()
open ViewGroup.LayoutParams
@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")
getLayoutParams()
Int
open Float
open Int
Boolean
open Unit
open Unit
open Unit
open Matrix
Int
Int
@ViewDebug.ExportedProperty(category = "measurement", flagMapping = [@ViewDebug.FlagToString(mask = -16777216, equals = 16777216, name = "MEASURED_STATE_TOO_SMALL")])
getMeasuredHeightAndState()
Int
Int
Int
@ViewDebug.ExportedProperty(category = "measurement", flagMapping = [@ViewDebug.FlagToString(mask = -16777216, equals = 16777216, name = "MEASURED_STATE_TOO_SMALL")])
getMeasuredWidthAndState()
open Int
open Int
open Int
open Int
open Int
open Int
open Int
open Int
open View.OnFocusChangeListener
open Int
open ViewOutlineProvider
open Int
open Int
open ViewOverlay
open Int
open Int
open Int
open Int
open Int
open Int
ViewParent
open ViewParent
OutcomeReceiver<GetCredentialResponseGetCredentialException>?
GetCredentialRequest?
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getPivotX()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getPivotY()
open PointerIcon
MutableList<Rect>
open Array<String>?
open Float
open Resources
Boolean
Int
open Float
open Int
open AttachedSurfaceControl?
open View
open WindowInsets
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotation()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotationX()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotationY()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getScaleX()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getScaleY()
open Int
open Int
open Int
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "INSIDE_OVERLAY"), @ViewDebug.IntToString(from = 16777216, to = "INSIDE_INSET"), @ViewDebug.IntToString(from = 33554432, to = "OUTSIDE_OVERLAY"), @ViewDebug.IntToString(from = 50331648, to = "OUTSIDE_INSET")])
getScrollBarStyle()
open Int
open Int
Int
Int
open Int
@ViewDebug.ExportedProperty(category = "drawing")
getSolidColor()
open Int
CharSequence?
@ViewDebug.ExportedProperty(category = "accessibility")
getStateDescription()
open StateListAnimator
open Int
open Int
open CharSequence?
open MutableList<Rect>
open Int

This function is deprecated. Deprecated in Java

open Any
open Any
getTag(p0: Int)
open Int
@ViewDebug.ExportedProperty(category = "text", mapping = [@ViewDebug.IntToString(from = 0, to = "INHERIT"), @ViewDebug.IntToString(from = 1, to = "GRAVITY"), @ViewDebug.IntToString(from = 2, to = "TEXT_START"), @ViewDebug.IntToString(from = 3, to = "TEXT_END"), @ViewDebug.IntToString(from = 4, to = "CENTER"), @ViewDebug.IntToString(from = 5, to = "VIEW_START"), @ViewDebug.IntToString(from = 6, to = "VIEW_END")])
getTextAlignment()
open Int
@ViewDebug.ExportedProperty(category = "text", mapping = [@ViewDebug.IntToString(from = 0, to = "INHERIT"), @ViewDebug.IntToString(from = 1, to = "FIRST_STRONG"), @ViewDebug.IntToString(from = 2, to = "ANY_RTL"), @ViewDebug.IntToString(from = 3, to = "LTR"), @ViewDebug.IntToString(from = 4, to = "RTL"), @ViewDebug.IntToString(from = 5, to = "LOCALE"), @ViewDebug.IntToString(from = 6, to = "FIRST_STRONG_LTR"), @ViewDebug.IntToString(from = 7, to = "FIRST_STRONG_RTL")])
getTextDirection()
open CharSequence?
Int
open Float
open Int
open TouchDelegate
open ArrayList<View>
open Float
open String
open Float
open Float
open Float
open Long
open Int
open Int
open Drawable?
open Drawable?
open Int
open ViewTranslationResponse?
open ViewTreeObserver
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "VISIBLE"), @ViewDebug.IntToString(from = 4, to = "INVISIBLE"), @ViewDebug.IntToString(from = 8, to = "GONE")])
getVisibility()
Int
@ViewDebug.ExportedProperty(category = "layout")
getWidth()
open Int
open WindowId
open WindowInsetsController?
open Int

This function is deprecated. Deprecated in Java

open IBinder
open Int
open Unit
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getX()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getY()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getZ()
open Boolean
open Boolean
@ViewDebug.ExportedProperty(category = "focus")
hasFocus()
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
invalidate(p0: Int, p1: Int, p2: Int, p3: Int)

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
Boolean
@ViewDebug.ExportedProperty(category = "focus")
isFocusable()
Boolean
open Boolean
@ViewDebug.ExportedProperty(category = "focus")
isFocused()
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
@ViewDebug.ExportedProperty(category = "drawing")
isOpaque()
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Unit
open View
open Unit
layout(p0: Int, p1: Int, p2: Int, p3: Int)
Unit
measure(p0: Int, p1: Int)
open Unit
open Unit
open Unit
open Unit
open WindowInsets
open Unit
open Boolean
open Boolean
open Unit
open IntArray
open InputConnection
open Unit
open Unit
open Unit
open Boolean
open Unit
Unit
open Boolean
open Unit
open Unit
open Unit
open Boolean
open Unit
open Unit
open Boolean
onKeyDown(p0: Int, p1: KeyEvent)
open Boolean
open Boolean
onKeyMultiple(p0: Int, p1: Int, p2: KeyEvent)
open Boolean
onKeyPreIme(p0: Int, p1: KeyEvent)
open Boolean
open Boolean
onKeyUp(p0: Int, p1: KeyEvent)
open Unit
onMeasure(p0: Int, p1: Int)
open Unit
onOverScrolled(p0: Int, p1: Int, p2: Boolean, p3: Boolean)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open ContentInfo?
open PointerIcon
open Unit
open Unit
open Unit
onScrollCaptureSearch(
    p0: Rect,
    p1: Point,
    p2: Consumer<ScrollCaptureTarget>
)
open Boolean
open Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Boolean
overScrollBy(
    p0: Int,
    p1: Int,
    p2: Int,
    p3: Int,
    p4: Int,
    p5: Int,
    p6: Int,
    p7: Int,
    p8: Boolean
)
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open ContentInfo?
open Unit
open Boolean
open Boolean
open Unit
open Unit
postInvalidate(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
open Unit
postInvalidateDelayed(p0: Long, p1: Int, p2: Int, p3: Int, p4: Int)
open Unit
open Unit
postInvalidateOnAnimation(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
open Unit
open Unit
open Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

Boolean
Boolean
open Boolean
requestFocus(p0: Int, p1: Rect)
Boolean
open Unit
open Unit
open Boolean
open Boolean
Unit
Unit
T
<T : View> requireViewById(p0: Int)
open Unit
open Boolean
open Unit
Unit
saveAttributeDataForStyleable(
    p0: Context,
    p1: IntArray,
    p2: AttributeSet?,
    p3: TypedArray,
    p4: Int,
    p5: Int
)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setAutofillHints(vararg p0: String?)
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setId(p0: Int)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setLayerType(p0: Int, p1: Paint?)
open Unit
open Unit
Unit
setLeft(p0: Int)
Unit
setLeftTopRightBottom(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setPadding(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
setPaddingRelative(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
open Unit
open Unit
open Unit
Unit
Unit
open Unit
open Unit
open Unit
Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
setTag(p0: Any)
open Unit
setTag(p0: Int, p1: Any)
open Unit
open Unit
open Unit
Unit
setTop(p0: Int)
open Unit
open Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
setX(p0: Float)
open Unit
setY(p0: Float)
open Unit
setZ(p0: Float)
open Boolean
open Boolean
open ActionMode
open ActionMode
open Unit
Boolean
startDrag(p0: ClipData, p1: View.DragShadowBuilder, p2: Any, p3: Int)

This function is deprecated. Deprecated in Java

Boolean
open Boolean
open Unit
open String
open Unit
open Unit
open Unit
open Unit
Unit
open Boolean
open Boolean

This function is deprecated. Deprecated in Java

open Boolean
@ViewDebug.ExportedProperty(category = "drawing")
willNotDraw()

Constants

GESTURE_STATE_IDLE

const val GESTURE_STATE_IDLE = 0: Int

The PdfView is not currently being affected by an outside input, e.g. user touch

GESTURE_STATE_INTERACTING

const val GESTURE_STATE_INTERACTING = 1: Int

The PdfView is currently being affected by an outside input, e.g. user touch

GESTURE_STATE_SETTLING

const val GESTURE_STATE_SETTLING = 2: Int

The PdfView is currently animating to a final position while not under outside control, e.g. settling on a final position following a fling gesture.

Public constructors

PdfView

Added in 1.0.0-alpha10
PdfView(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0)

Public functions

addOnGestureStateChangedListener

Added in 1.0.0-alpha10
fun addOnGestureStateChangedListener(
    listener: PdfView.OnGestureStateChangedListener
): Unit

Adds the specified listener to the list of listeners that will be notified of changes in state with respect to this PdfView being affected by an external input, e.g. user touch.

Parameters
listener: PdfView.OnGestureStateChangedListener

listener to notify when interaction state change events occur

addOnSelectionChangedListener

Added in 1.0.0-alpha10
fun addOnSelectionChangedListener(
    listener: PdfView.OnSelectionChangedListener
): Unit

Adds the specified listener to the list of listeners that will be notified of selection change events.

Parameters
listener: PdfView.OnSelectionChangedListener

listener to notify when selection change events occur

addOnViewportChangedListener

Added in 1.0.0-alpha10
fun addOnViewportChangedListener(
    listener: PdfView.OnViewportChangedListener
): Unit

Adds the specified listener to the list of listeners that will be notified of viewport change events.

Parameters
listener: PdfView.OnViewportChangedListener

listener to add

clearSelection

Added in 1.0.0-alpha10
fun clearSelection(): Unit

Clears the current selection, if one exists. No-op if there is no current Selection

computeScroll

open fun computeScroll(): Unit

dispatchKeyEvent

open fun dispatchKeyEvent(event: KeyEvent?): Boolean

Prioritizes standard keyboard shortcuts over accessibility-specific handling of certain keys. This ensures a consistent experience for all users, where shortcuts like D-pad scrolling work irrespective of whether accessibility is enabled or not, as both externalInputManager and pdfViewAccessibilityManager are capable of handling certain key events.

onGenericMotionEvent

open fun onGenericMotionEvent(event: MotionEvent?): Boolean

onTouchEvent

open fun onTouchEvent(event: MotionEvent?): Boolean

pdfToViewPoint

Added in 1.0.0-alpha10
fun pdfToViewPoint(pdfPoint: PdfPoint): PointF?

Returns the View coordinate location of pdfPoint, or null if that PDF content has not been laid out yet.

removeOnGestureStateChangedListener

Added in 1.0.0-alpha10
fun removeOnGestureStateChangedListener(
    listener: PdfView.OnGestureStateChangedListener
): Unit

Removes the specified listener from the list of listeners that will be notified of changes in state with respect to this PdfView being affected by an external input, e.g. user touch.

Parameters
listener: PdfView.OnGestureStateChangedListener

listener to remove

removeOnSelectionChangedListener

Added in 1.0.0-alpha10
fun removeOnSelectionChangedListener(
    listener: PdfView.OnSelectionChangedListener
): Unit

Removes the specified listener from the list of listeners that will be notified of selection change events.

Parameters
listener: PdfView.OnSelectionChangedListener

listener to remove

removeOnViewportChangedListener

Added in 1.0.0-alpha10
fun removeOnViewportChangedListener(
    listener: PdfView.OnViewportChangedListener
): Unit

Removes the specified listener from the list of listeners that will be notified of viewport change events.

Parameters
listener: PdfView.OnViewportChangedListener

listener to remove

scrollBy

open fun scrollBy(x: Int, y: Int): Unit

scrollTo

open fun scrollTo(x: Int, y: Int): Unit

scrollToPage

Added in 1.0.0-alpha10
fun scrollToPage(pageNum: Int): Unit

Scrolls to the 0-indexed pageNum, optionally animating the scroll

This View cannot scroll to a page until it knows its dimensions. If pageNum is distant from the currently-visible page in a large PDF, there may be some delay while dimensions are being loaded from the PDF.

scrollToPosition

Added in 1.0.0-alpha10
fun scrollToPosition(position: PdfPoint): Unit

Scrolls to position, optionally animating the scroll

This View cannot scroll to a page until it knows its dimensions. If position is distant from the currently-visible page in a large PDF, there may be some delay while dimensions are being loaded from the PDF.

setHighlights

Added in 1.0.0-alpha10
fun setHighlights(highlights: List<Highlight>): Unit

Applies a set of Highlight to be drawn over this PDF. Each Highlight may be a different color. This overrides any previous highlights, there is no merging of new and previous values. highlights are defensively copied and the list or its contents may be modified after providing it here.

setLinkClickListener

Added in 1.0.0-alpha10
fun setLinkClickListener(listener: PdfView.LinkClickListener?): Unit

Registers listener as the callback to be invoked when an external link in the PDF is clicked. Supply null to clear any current listener.

viewToPdfPoint

Added in 1.0.0-alpha10
fun viewToPdfPoint(viewPoint: PointF): PdfPoint?

Returns the PdfPoint corresponding to viewPoint in View coordinates, or null if no PDF content has been laid out at viewPoint

viewToPdfPoint

Added in 1.0.0-alpha10
fun viewToPdfPoint(x: Float, y: Float): PdfPoint?

Returns the PdfPoint corresponding to (x, y)in View coordinates, or null if no PDF content has been laid out at that point.

Protected functions

computeHorizontalScrollRange

protected open fun computeHorizontalScrollRange(): Int

computeVerticalScrollRange

protected open fun computeVerticalScrollRange(): Int

dispatchHoverEvent

protected open fun dispatchHoverEvent(event: MotionEvent?): Boolean

onAttachedToWindow

protected open fun onAttachedToWindow(): Unit

onConfigurationChanged

protected open fun onConfigurationChanged(newConfig: Configuration?): Unit

onDetachedFromWindow

protected open fun onDetachedFromWindow(): Unit

onDraw

protected open fun onDraw(canvas: Canvas): Unit

onFocusChanged

protected open fun onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect?
): Unit

onLayout

protected open fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit

onRestoreInstanceState

protected open fun onRestoreInstanceState(state: Parcelable?): Unit

onSaveInstanceState

protected open fun onSaveInstanceState(): Parcelable?

onScrollChanged

protected open fun onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int): Unit

onSizeChanged

protected open fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int): Unit

onWindowVisibilityChanged

protected open fun onWindowVisibilityChanged(visibility: Int): Unit

Public properties

currentSelection

Added in 1.0.0-alpha10
val currentSelectionSelection?

The currently selected PDF content, as Selection

fastScrollPageIndicatorBackgroundDrawable

Added in 1.0.0-alpha10
var fastScrollPageIndicatorBackgroundDrawableDrawable

fastScrollPageIndicatorMarginEnd

Added in 1.0.0-alpha10
var fastScrollPageIndicatorMarginEndInt

fastScrollVerticalThumbDrawable

Added in 1.0.0-alpha10
var fastScrollVerticalThumbDrawableDrawable

fastScrollVerticalThumbMarginEnd

Added in 1.0.0-alpha10
var fastScrollVerticalThumbMarginEndInt

firstVisiblePage

Added in 1.0.0-alpha10
val firstVisiblePageInt

The first page in the viewport, including partially-visible pages. 0-indexed.

gestureState

Added in 1.0.0-alpha10
val gestureStateInt

The current state of the PDF view with respect to external inputs, e.g. user touch. Returns one of GESTURE_STATE_IDLE, GESTURE_STATE_INTERACTING, or GESTURE_STATE_SETTLING

maxZoom

Added in 1.0.0-alpha10
var maxZoomFloat

The maximum scaling factor that can be applied to this View using the zoom property

minZoom

Added in 1.0.0-alpha10
var minZoomFloat

The minimum scaling factor that can be applied to this View using the zoom property

pdfDocument

Added in 1.0.0-alpha10
var pdfDocumentPdfDocument?

Supply a PdfDocument to process the PDF content for rendering

visiblePagesCount

Added in 1.0.0-alpha10
val visiblePagesCountInt

The number of pages visible in the viewport, including partially visible pages

zoom

Added in 1.0.0-alpha10
var zoomFloat

The zoom level of this view, as a factor of the content's natural size with when 1 pixel is equal to 1 PDF point. Will always be clamped within (minZoom, maxZoom)