-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.ViewManager,android.view.ViewParent,android.view.accessibility.AccessibilityEventSource
public final class PDFView extends RelativeLayout
It supports animations, zoom, cache, and swipe.
To fully understand this class you must know its principles :
The PDF document is seen as if we always want to draw all the pages.
The thing is that we only draw the visible parts.
All parts are the same size, this is because we can't interrupt a native page rendering, so we need these renderings to be as fast as possible, and be able to interrupt them as soon as we can.
The parts are loaded when the current offset or the current zoom level changes
Important :
DocumentPage = A page of the PDF document.
UserPage = A page as defined by the user. By default, they're the same. But the user can change the pages order using .load. In this particular case, a userPage of 5 can refer to a documentPage of 17.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumPDFView.ScrollDirSTART - scrolling in first page direction END - scrolling in last page direction NONE - not scrolling
public final classPDFView.Configuratorpublic classPDFView.Companion
-
Field Summary
Fields Modifier and Type Field Description private PdfFilepdfFileprivate IntegercurrentPageprivate FloatcurrentXOffsetprivate FloatcurrentYOffsetprivate Floatzoomprivate BooleanisRecycledprivate Callbackscallbacksprivate FitPolicypageFitPolicyprivate BooleanisFitEachPageprivate BooleanisSwipeVerticalprivate BooleanisSwipeEnabledprivate BooleanisDoubletapEnabledprivate BooleanisPageSnapprivate ScrollHandlescrollHandleprivate BooleanisBestQualityprivate BooleanisAnnotationRenderingprivate BooleanisAntialiasingprivate IntegerspacingPxprivate BooleanisAutoSpacingEnabledprivate BooleanisPageFlingEnabledprivate BooleanisTextSelectionEnabledprivate final FloatpositionOffsetprivate final IntegerpageCountprivate BooleanisZoomGestureprivate final BooleanisZoomingprivate final PdfDocumentdocumentMetaprivate final List<PdfBookmark>tableOfContentsprivate final List<PdfBookmark>bookmarks
-
Constructor Summary
Constructors Constructor Description PDFView(Context context, AttributeSet set)
-
Method Summary
Modifier and Type Method Description final PdfFilegetPdfFile()final UnitsetPdfFile(PdfFile pdfFile)final IntegergetCurrentPage()The index of the current sequence final UnitsetCurrentPage(Integer currentPage)final FloatgetCurrentXOffset()If you picture all the pages side by side in their optimal width, and taking into account the zoom level, the current offset is the position of the left border of the screen in this big picture final UnitsetCurrentXOffset(Float currentXOffset)final FloatgetCurrentYOffset()If you picture all the pages side by side in their optimal width, and taking into account the zoom level, the current offset is the position of the left border of the screen in this big picture final UnitsetCurrentYOffset(Float currentYOffset)final FloatgetZoom()The zoom level, always >= 1 final UnitsetZoom(Float zoom)final BooleangetIsRecycled()True if the PDFView has been recycled final UnitsetIsRecycled(Boolean isRecycled)final CallbacksgetCallbacks()final UnitsetCallbacks(Callbacks callbacks)final FitPolicygetPageFitPolicy()Policy for fitting pages to screen final UnitsetPageFitPolicy(FitPolicy pageFitPolicy)final BooleangetIsFitEachPage()final UnitsetIsFitEachPage(Boolean isFitEachPage)final BooleangetIsSwipeVertical()True if should scroll through pages vertically instead of horizontally final UnitsetIsSwipeVertical(Boolean isSwipeVertical)final BooleangetIsSwipeEnabled()final UnitsetIsSwipeEnabled(Boolean isSwipeEnabled)final BooleangetIsDoubletapEnabled()final UnitsetIsDoubletapEnabled(Boolean isDoubletapEnabled)final BooleangetIsPageSnap()final UnitsetIsPageSnap(Boolean isPageSnap)final ScrollHandlegetScrollHandle()final UnitsetScrollHandle(ScrollHandle scrollHandle)final BooleangetIsBestQuality()True if bitmap should use ARGB_8888 format and take more memory False if bitmap should be compressed by using RGB_565 format and take less memory final UnitsetIsBestQuality(Boolean isBestQuality)final BooleangetIsAnnotationRendering()True if annotations should be rendered False otherwise final UnitsetIsAnnotationRendering(Boolean isAnnotationRendering)final BooleangetIsAntialiasing()Antialiasing and bitmap filtering final UnitsetIsAntialiasing(Boolean isAntialiasing)final IntegergetSpacingPx()Spacing between pages, in px final UnitsetSpacingPx(Integer spacingPx)final BooleangetIsAutoSpacingEnabled()Add dynamic spacing to fit each page separately on the screen. final UnitsetIsAutoSpacingEnabled(Boolean isAutoSpacingEnabled)final BooleangetIsPageFlingEnabled()Fling a single page at a time final UnitsetIsPageFlingEnabled(Boolean isPageFlingEnabled)final BooleangetIsTextSelectionEnabled()Whether text selection is enabled final UnitsetIsTextSelectionEnabled(Boolean isTextSelectionEnabled)final FloatgetPositionOffset()final IntegergetPageCount()final BooleangetIsZoomGesture()Flag set during zoom gestures (pinch/double-tap) to prevent scrollDir updates final UnitsetIsZoomGesture(Boolean isZoomGesture)Flag set during zoom gestures (pinch/double-tap) to prevent scrollDir updates final BooleangetIsZooming()final PdfDocumentgetDocumentMeta()final List<PdfBookmark>getTableOfContents()final List<PdfBookmark>getBookmarks()final UnitsetScrollStart(Float x, Float y)Set the starting offsets of a scroll gesture final UnitresetScrollDir()Reset scroll direction to NONE - called after zoom to prevent page changes final UnitsetTextSelectionEnabled(Boolean enabled)Enable or disable text selection. final BooleanstartTextSelection(Float screenX, Float screenY)Start text selection at the given screen coordinates. final UnitclearTextSelection()Clear the current text selection. final StringgetSelectedText()Get the currently selected text. final UnitselectAllText(Integer page)final UnitupdateSelectionDrag(Float screenX, Float screenY)Update selection end point during drag. final UnitsetSelectionHandleColor(Integer color)Set color for selection handles. final UnitsetSelectionHighlightColor(Integer color)Set color for selection highlight. final UnitjumpTo(Integer page, Boolean withAnimation)Go to the given page. final UnitjumpTo(Integer page)final UnitshowPage(Integer pageNb)final UnitsetPositionOffset(Float progress, Boolean moveHandle)final UnitsetPositionOffset(Float progress)final UnitstopFling()final UnitsetSwipeEnabled(Boolean enableSwipe)final UnitsetNightMode(Boolean nightMode)final UnitenableDoubletap(Boolean enableDoubletap)final UnitonPageError(PageRenderingException ex)final Unitrecycle()UnitcomputeScroll()Handle fling animation BooleancanScrollHorizontally(Integer direction)BooleancanScrollVertically(Integer direction)final UnitloadPages()Load all the parts around the center of the screen, taking into account X and Y offsets, zoom level, and the current page displayed final UnitloadComplete(PdfFile pdfFile)Called when the PDF is loaded final UnitloadError(Throwable t)final Unitredraw()final UnitonBitmapRendered(PagePart part)Called when a rendering task is over and a PagePart has been freshly created. final UnitmoveTo(Float offsetX, Float offsetY)final UnitmoveTo(Float offsetX, Float offsetY, Boolean moveHandle)Move to the given X and Y offsets, but check them ahead of time to be sure not to go outside the the big strip. final UnitloadPageByOffset()final UnitperformPageSnap()Animate to the nearest snapping position for the current SnapPolicy. final SnapEdgefindSnapEdge(Integer page)Find the edge to snap to when showing the specified page final FloatsnapOffsetForPage(Integer pageIndex, SnapEdge edge)Get the offset to move to in order to snap to the page final IntegerfindFocusPage(Float xOffset, Float yOffset)final BooleanpageFillsScreen()final UnitmoveRelativeTo(Float dx, Float dy)Move relatively to the current position. final UnitzoomTo(Float zoom)Change the zoom level.\n * Cache is NOT invalidated - natural LRU eviction handles tile replacement. final UnitzoomCenteredTo(Float zoom, PointF pivot)Change the zoom level, relatively to a pivot point. final UnitzoomCenteredRelativeTo(Float dzoom, PointF pivot)final BooleandocumentFitsView()Checks if whole document can be displayed on screen, doesn't include zoom final UnitfitToWidth(Integer page)final SizeFgetPageSize(Integer pageIndex)final FloattoRealScale(Float size)final FloattoCurrentScale(Float size)final UnitresetZoom()final UnitresetZoomWithAnimation()final UnitzoomWithAnimation(Float centerX, Float centerY, Float scale)final UnitzoomWithAnimation(Float scale)final IntegergetPageAtPositionOffset(Float positionOffset)Get page number at given offset final FloatgetMinZoom()final UnitsetMinZoom(Float minZoom)final FloatgetMidZoom()final UnitsetMidZoom(Float midZoom)final FloatgetMaxZoom()final UnitsetMaxZoom(Float maxZoom)final UnituseBestQuality(Boolean bestQuality)final UnitsetSwipeVertical(Boolean swipeVertical)final UnitenableAnnotationRendering(Boolean annotationRendering)final UnitenableRenderDuringScale(Boolean renderDuringScale)final UnitenableAntialiasing(Boolean enableAntialiasing)final UnitsetPageFling(Boolean pageFling)final UnitsetPageSnap(Boolean pageSnap)final BooleandoRenderDuringScale()final List<PdfLink>getLinks(Integer page)Will be empty until document is loaded final PdfViewStatesaveState()Save the current state of the PDF viewer. final UnitrestoreState(PdfViewState state, Boolean animate)Restore a previously saved state. final PDFView.ConfiguratorfromAsset(String assetName)Use an asset file as the pdf source final PDFView.ConfiguratorfromFile(File file)Use a file as the pdf source final PDFView.ConfiguratorfromUri(Uri uri)Use URI as the pdf source, for use with content providers final PDFView.ConfiguratorfromBytes(ByteArray bytes)Use bytearray as the pdf source, documents is not saved final PDFView.ConfiguratorfromStream(InputStream stream)Use stream as the pdf source. final PDFView.ConfiguratorfromSource(DocumentSource docSource)Use custom source as pdf source final Pair<Integer, PointF>getPagePoint(Float x, Float y)Converts screen coordinates to Page Index and PDF Point. -
Methods inherited from class android.view.ViewGroup
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearPendingCredentialRequest, clearViewTranslationCallback, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateDisplayHash, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAllowedHandwritingDelegatePackageName, getAllowedHandwritingDelegatorPackageName, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContentSensitivity, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getFrameContentVelocity, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHandwritingBoundsOffsetBottom, getHandwritingBoundsOffsetLeft, getHandwritingBoundsOffsetRight, getHandwritingBoundsOffsetTop, getHandwritingDelegateFlags, getHandwritingDelegatorCallback, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPendingCredentialCallback, getPendingCredentialRequest, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getRequestedFrameRate, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSupplementalDescription, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityDataSensitive, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContentSensitive, isContextClickable, isCredential, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHandwritingDelegate, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollCaptureSearch, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, reportAppJankStats, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requestUnbufferedDispatch, requireViewById, resetPivot, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDataSensitive, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAllowedHandwritingDelegatePackage, setAllowedHandwritingDelegatorPackage, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContentSensitivity, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setFrameContentVelocity, setHandwritingBoundsOffsets, setHandwritingDelegateFlags, setHandwritingDelegatorCallback, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setIsCredential, setIsHandwritingDelegate, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPendingCredentialRequest, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSupplementalDescription, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDraw -
Methods inherited from class android.widget.RelativeLayout
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawChild, drawableStateChanged, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildDrawingOrder, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildWithMargins, measureChildren, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAttachedToWindow, onCreateDrawableState, onDescendantInvalidated, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, propagateRequestedFrameRate, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setRequestedFrameRate, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, showContextMenuForChild, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout -
Methods inherited from class com.hyntix.pdf.viewer.PDFView
checkLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getBaseline, getGravity, getIgnoreGravity, onLayout, onMeasure, requestLayout, setGravity, setHorizontalGravity, setIgnoreGravity, setVerticalGravity, shouldDelayChildPressedState -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
PDFView
PDFView(Context context, AttributeSet set)
-
-
Method Detail
-
getPdfFile
final PdfFile getPdfFile()
-
setPdfFile
final Unit setPdfFile(PdfFile pdfFile)
-
getCurrentPage
final Integer getCurrentPage()
The index of the current sequence
-
setCurrentPage
final Unit setCurrentPage(Integer currentPage)
-
getCurrentXOffset
final Float getCurrentXOffset()
If you picture all the pages side by side in their optimal width, and taking into account the zoom level, the current offset is the position of the left border of the screen in this big picture
-
setCurrentXOffset
final Unit setCurrentXOffset(Float currentXOffset)
-
getCurrentYOffset
final Float getCurrentYOffset()
If you picture all the pages side by side in their optimal width, and taking into account the zoom level, the current offset is the position of the left border of the screen in this big picture
-
setCurrentYOffset
final Unit setCurrentYOffset(Float currentYOffset)
-
getIsRecycled
final Boolean getIsRecycled()
True if the PDFView has been recycled
-
setIsRecycled
final Unit setIsRecycled(Boolean isRecycled)
-
getCallbacks
final Callbacks getCallbacks()
-
setCallbacks
final Unit setCallbacks(Callbacks callbacks)
-
getPageFitPolicy
final FitPolicy getPageFitPolicy()
Policy for fitting pages to screen
-
setPageFitPolicy
final Unit setPageFitPolicy(FitPolicy pageFitPolicy)
-
getIsFitEachPage
final Boolean getIsFitEachPage()
-
setIsFitEachPage
final Unit setIsFitEachPage(Boolean isFitEachPage)
-
getIsSwipeVertical
final Boolean getIsSwipeVertical()
True if should scroll through pages vertically instead of horizontally
-
setIsSwipeVertical
final Unit setIsSwipeVertical(Boolean isSwipeVertical)
-
getIsSwipeEnabled
final Boolean getIsSwipeEnabled()
-
setIsSwipeEnabled
final Unit setIsSwipeEnabled(Boolean isSwipeEnabled)
-
getIsDoubletapEnabled
final Boolean getIsDoubletapEnabled()
-
setIsDoubletapEnabled
final Unit setIsDoubletapEnabled(Boolean isDoubletapEnabled)
-
getIsPageSnap
final Boolean getIsPageSnap()
-
setIsPageSnap
final Unit setIsPageSnap(Boolean isPageSnap)
-
getScrollHandle
final ScrollHandle getScrollHandle()
-
setScrollHandle
final Unit setScrollHandle(ScrollHandle scrollHandle)
-
getIsBestQuality
final Boolean getIsBestQuality()
True if bitmap should use ARGB_8888 format and take more memory False if bitmap should be compressed by using RGB_565 format and take less memory
-
setIsBestQuality
final Unit setIsBestQuality(Boolean isBestQuality)
-
getIsAnnotationRendering
final Boolean getIsAnnotationRendering()
True if annotations should be rendered False otherwise
-
setIsAnnotationRendering
final Unit setIsAnnotationRendering(Boolean isAnnotationRendering)
-
getIsAntialiasing
final Boolean getIsAntialiasing()
Antialiasing and bitmap filtering
-
setIsAntialiasing
final Unit setIsAntialiasing(Boolean isAntialiasing)
-
getSpacingPx
final Integer getSpacingPx()
Spacing between pages, in px
-
setSpacingPx
final Unit setSpacingPx(Integer spacingPx)
-
getIsAutoSpacingEnabled
final Boolean getIsAutoSpacingEnabled()
Add dynamic spacing to fit each page separately on the screen.
-
setIsAutoSpacingEnabled
final Unit setIsAutoSpacingEnabled(Boolean isAutoSpacingEnabled)
-
getIsPageFlingEnabled
final Boolean getIsPageFlingEnabled()
Fling a single page at a time
-
setIsPageFlingEnabled
final Unit setIsPageFlingEnabled(Boolean isPageFlingEnabled)
-
getIsTextSelectionEnabled
final Boolean getIsTextSelectionEnabled()
Whether text selection is enabled
-
setIsTextSelectionEnabled
final Unit setIsTextSelectionEnabled(Boolean isTextSelectionEnabled)
-
getPositionOffset
final Float getPositionOffset()
-
getPageCount
final Integer getPageCount()
-
getIsZoomGesture
final Boolean getIsZoomGesture()
Flag set during zoom gestures (pinch/double-tap) to prevent scrollDir updates
-
setIsZoomGesture
final Unit setIsZoomGesture(Boolean isZoomGesture)
Flag set during zoom gestures (pinch/double-tap) to prevent scrollDir updates
-
getIsZooming
final Boolean getIsZooming()
-
getDocumentMeta
final PdfDocument getDocumentMeta()
-
getTableOfContents
final List<PdfBookmark> getTableOfContents()
-
getBookmarks
final List<PdfBookmark> getBookmarks()
-
setScrollStart
final Unit setScrollStart(Float x, Float y)
Set the starting offsets of a scroll gesture
-
resetScrollDir
final Unit resetScrollDir()
Reset scroll direction to NONE - called after zoom to prevent page changes
-
setTextSelectionEnabled
final Unit setTextSelectionEnabled(Boolean enabled)
Enable or disable text selection.
-
startTextSelection
final Boolean startTextSelection(Float screenX, Float screenY)
Start text selection at the given screen coordinates.
-
clearTextSelection
final Unit clearTextSelection()
Clear the current text selection.
-
getSelectedText
final String getSelectedText()
Get the currently selected text.
-
selectAllText
final Unit selectAllText(Integer page)
-
updateSelectionDrag
final Unit updateSelectionDrag(Float screenX, Float screenY)
Update selection end point during drag.
-
setSelectionHandleColor
final Unit setSelectionHandleColor(Integer color)
Set color for selection handles.
-
setSelectionHighlightColor
final Unit setSelectionHighlightColor(Integer color)
Set color for selection highlight.
-
jumpTo
final Unit jumpTo(Integer page, Boolean withAnimation)
Go to the given page.
- Parameters:
page- Page index.
-
setPositionOffset
final Unit setPositionOffset(Float progress, Boolean moveHandle)
- Parameters:
progress- must be between 0 and 1moveHandle- whether to move scroll handle
-
setPositionOffset
final Unit setPositionOffset(Float progress)
-
setSwipeEnabled
final Unit setSwipeEnabled(Boolean enableSwipe)
-
setNightMode
final Unit setNightMode(Boolean nightMode)
-
enableDoubletap
final Unit enableDoubletap(Boolean enableDoubletap)
-
onPageError
final Unit onPageError(PageRenderingException ex)
-
computeScroll
Unit computeScroll()
Handle fling animation
-
canScrollHorizontally
Boolean canScrollHorizontally(Integer direction)
-
canScrollVertically
Boolean canScrollVertically(Integer direction)
-
loadPages
final Unit loadPages()
Load all the parts around the center of the screen, taking into account X and Y offsets, zoom level, and the current page displayed
-
loadComplete
final Unit loadComplete(PdfFile pdfFile)
Called when the PDF is loaded
-
onBitmapRendered
final Unit onBitmapRendered(PagePart part)
Called when a rendering task is over and a PagePart has been freshly created.
- Parameters:
part- The created PagePart.
-
moveTo
final Unit moveTo(Float offsetX, Float offsetY, Boolean moveHandle)
Move to the given X and Y offsets, but check them ahead of time to be sure not to go outside the the big strip.
- Parameters:
offsetX- The big strip X offset to use as the left border of the screen.offsetY- The big strip Y offset to use as the right border of the screen.moveHandle- whether to move scroll handle or not
-
loadPageByOffset
final Unit loadPageByOffset()
-
performPageSnap
final Unit performPageSnap()
Animate to the nearest snapping position for the current SnapPolicy. Uses carousel behavior: any scroll in a direction triggers snap to next/previous page.
-
findSnapEdge
final SnapEdge findSnapEdge(Integer page)
Find the edge to snap to when showing the specified page
-
snapOffsetForPage
final Float snapOffsetForPage(Integer pageIndex, SnapEdge edge)
Get the offset to move to in order to snap to the page
-
findFocusPage
final Integer findFocusPage(Float xOffset, Float yOffset)
-
pageFillsScreen
final Boolean pageFillsScreen()
-
moveRelativeTo
final Unit moveRelativeTo(Float dx, Float dy)
Move relatively to the current position.
- Parameters:
dx- The X difference you want to apply.dy- The Y difference you want to apply.
-
zoomTo
final Unit zoomTo(Float zoom)
Change the zoom level.\n * Cache is NOT invalidated - natural LRU eviction handles tile replacement.
-
zoomCenteredTo
final Unit zoomCenteredTo(Float zoom, PointF pivot)
Change the zoom level, relatively to a pivot point. It will call moveTo() to make sure the given point stays in the middle of the screen.
- Parameters:
zoom- The zoom level.pivot- The point on the screen that should stays.
-
zoomCenteredRelativeTo
final Unit zoomCenteredRelativeTo(Float dzoom, PointF pivot)
-
documentFitsView
final Boolean documentFitsView()
Checks if whole document can be displayed on screen, doesn't include zoom
-
fitToWidth
final Unit fitToWidth(Integer page)
-
getPageSize
final SizeF getPageSize(Integer pageIndex)
-
toRealScale
final Float toRealScale(Float size)
-
toCurrentScale
final Float toCurrentScale(Float size)
-
resetZoomWithAnimation
final Unit resetZoomWithAnimation()
-
zoomWithAnimation
final Unit zoomWithAnimation(Float centerX, Float centerY, Float scale)
-
zoomWithAnimation
final Unit zoomWithAnimation(Float scale)
-
getPageAtPositionOffset
final Integer getPageAtPositionOffset(Float positionOffset)
Get page number at given offset
- Parameters:
positionOffset- scroll offset between 0 and 1
-
getMinZoom
final Float getMinZoom()
-
setMinZoom
final Unit setMinZoom(Float minZoom)
-
getMidZoom
final Float getMidZoom()
-
setMidZoom
final Unit setMidZoom(Float midZoom)
-
getMaxZoom
final Float getMaxZoom()
-
setMaxZoom
final Unit setMaxZoom(Float maxZoom)
-
useBestQuality
final Unit useBestQuality(Boolean bestQuality)
-
setSwipeVertical
final Unit setSwipeVertical(Boolean swipeVertical)
-
enableAnnotationRendering
final Unit enableAnnotationRendering(Boolean annotationRendering)
-
enableRenderDuringScale
final Unit enableRenderDuringScale(Boolean renderDuringScale)
-
enableAntialiasing
final Unit enableAntialiasing(Boolean enableAntialiasing)
-
setPageFling
final Unit setPageFling(Boolean pageFling)
-
setPageSnap
final Unit setPageSnap(Boolean pageSnap)
-
doRenderDuringScale
final Boolean doRenderDuringScale()
-
saveState
final PdfViewState saveState()
Save the current state of the PDF viewer. Use this to persist state across configuration changes (rotation, theme change).
-
restoreState
final Unit restoreState(PdfViewState state, Boolean animate)
Restore a previously saved state. Call this after loading the document (e.g., in onLoadComplete callback).
- Parameters:
state- The saved PdfViewState to restoreanimate- Whether to animate the transition (default: false)
-
fromAsset
final PDFView.Configurator fromAsset(String assetName)
Use an asset file as the pdf source
-
fromFile
final PDFView.Configurator fromFile(File file)
Use a file as the pdf source
-
fromUri
final PDFView.Configurator fromUri(Uri uri)
Use URI as the pdf source, for use with content providers
-
fromBytes
final PDFView.Configurator fromBytes(ByteArray bytes)
Use bytearray as the pdf source, documents is not saved
-
fromStream
final PDFView.Configurator fromStream(InputStream stream)
Use stream as the pdf source. Stream will be written to bytearray, because native code does not support Java Streams
-
fromSource
final PDFView.Configurator fromSource(DocumentSource docSource)
Use custom source as pdf source
-
-
-
-