-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.ViewManager,android.view.ViewParent,android.view.accessibility.AccessibilityEventSource
public 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 classPDFView.Configurator
-
Field Summary
Fields Modifier and Type Field Description public final static floatDEFAULT_MAX_SCALEpublic final static floatDEFAULT_MID_SCALEpublic final static floatDEFAULT_MIN_SCALEprivate floatminZoomprivate floatmidZoomprivate floatmaxZoomprivate intcurrentPageprivate floatcurrentXOffsetprivate floatcurrentYOffsetprivate floatzoomprivate FitPolicypageFitPolicyprivate booleannightModeprivate booleanpageSnapprivate intspacingPxprivate booleanpageFling
-
Constructor Summary
Constructors Constructor Description PDFView(Context context, AttributeSet set)Construct the initial view
-
Method Summary
Modifier and Type Method Description floatgetMinZoom()voidsetMinZoom(float minZoom)floatgetMidZoom()voidsetMidZoom(float midZoom)floatgetMaxZoom()voidsetMaxZoom(float maxZoom)intgetCurrentPage()floatgetCurrentXOffset()floatgetCurrentYOffset()floatgetZoom()FitPolicygetPageFitPolicy()voidsetPageFitPolicy(FitPolicy pageFitPolicy)voidsetNightMode(boolean nightMode)voidsetPageSnap(boolean pageSnap)intgetSpacingPx()voidsetPageFling(boolean pageFling)voidjumpTo(int page, boolean withAnimation)Go to the given page. voidjumpTo(int page)floatgetPositionOffset()Get current position as ratio of document length to visible area. voidsetPositionOffset(float progress, boolean moveHandle)voidsetPositionOffset(float progress)voidstopFling()intgetPageCount()voidsetSwipeEnabled(boolean enableSwipe)voidrecycle()booleanisRecycled()voidcomputeScroll()Handle fling animation booleancanScrollHorizontally(int direction)booleancanScrollVertically(int direction)voidloadPages()Load all the parts around the center of the screen,taking into account X and Y offsets, zoom level, andthe current page displayed voidonBitmapRendered(PagePart part)Called when a rendering task is over anda PagePart has been freshly created. voidmoveTo(float offsetX, float offsetY)voidmoveTo(float offsetX, float offsetY, boolean moveHandle)Move to the given X and Y offsets, but check them ahead of timeto be sure not to go outside the the big strip. voidperformPageSnap()Animate to the nearest snapping position for the current SnapPolicy booleanpageFillsScreen()voidmoveRelativeTo(float dx, float dy)Move relatively to the current position. voidzoomTo(float zoom)Change the zoom level voidzoomCenteredTo(float zoom, PointF pivot)Change the zoom level, relatively to a pivot point.It will call moveTo() to make sure the given point staysin the middle of the screen. voidzoomCenteredRelativeTo(float dzoom, PointF pivot)booleandocumentFitsView()Checks if whole document can be displayed on screen, doesn't include zoom voidfitToWidth(int page)SizeFgetPageSize(int pageIndex)floattoRealScale(float size)floattoCurrentScale(float size)booleanisZooming()voidresetZoom()voidresetZoomWithAnimation()voidzoomWithAnimation(float centerX, float centerY, float scale)voidzoomWithAnimation(float scale)intgetPageAtPositionOffset(float positionOffset)Get page number at given offset voiduseBestQuality(boolean bestQuality)booleanisBestQuality()booleanisSwipeVertical()booleanisSwipeEnabled()voidenableAnnotationRendering(boolean annotationRendering)booleanisAnnotationRendering()voidenableRenderDuringScale(boolean renderDuringScale)booleanisAntialiasing()voidenableAntialiasing(boolean enableAntialiasing)booleanisAutoSpacingEnabled()booleanisPageFlingEnabled()booleanisFitEachPage()booleanisPageSnap()booleandoRenderDuringScale()PdfDocument.MetagetDocumentMeta()Returns null if document is not loaded List<PdfDocument.Bookmark>getTableOfContents()Will be empty until document is loaded List<PdfDocument.Link>getLinks(int page)Will be empty until document is loaded PDFView.ConfiguratorfromAsset(String assetName)Use an asset file as the pdf source PDFView.ConfiguratorfromFile(File file)Use a file as the pdf source PDFView.ConfiguratorfromUri(Uri uri)Use URI as the pdf source, for use with content providers PDFView.ConfiguratorfromBytes(Array<byte> bytes)Use bytearray as the pdf source, documents is not saved PDFView.ConfiguratorfromStream(InputStream stream)Use stream as the pdf source. PDFView.ConfiguratorfromSource(DocumentSource docSource)Use custom source as pdf source -
Methods inherited from class android.widget.RelativeLayout
generateLayoutParams, getAccessibilityClassName, getBaseline, getGravity, getIgnoreGravity, requestLayout, setGravity, setHorizontalGravity, setIgnoreGravity, setVerticalGravity, shouldDelayChildPressedState -
Methods inherited from class android.view.ViewGroup
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, clearChildFocus, clearDisappearingChildren, clearFocus, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onDescendantInvalidated, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout -
Methods inherited from class android.view.View
addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearViewTranslationCallback, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAllowedHandwritingDelegatePackageName, getAllowedHandwritingDelegatorPackageName, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getHandler, getHandwritingBoundsOffsetBottom, getHandwritingBoundsOffsetLeft, getHandwritingBoundsOffsetRight, getHandwritingBoundsOffsetTop, getHandwritingDelegatorCallback, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityDataSensitive, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, 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, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRtlPropertiesChanged, onScreenStateChanged, onScrollCaptureSearch, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocusFromTouch, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, 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, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHandwritingBoundsOffsets, setHandwritingDelegatorCallback, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setIsCredential, setIsHandwritingDelegate, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, 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, 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, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, 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, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw -
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)
Construct the initial view
-
-
Method Detail
-
getMinZoom
float getMinZoom()
-
setMinZoom
void setMinZoom(float minZoom)
-
getMidZoom
float getMidZoom()
-
setMidZoom
void setMidZoom(float midZoom)
-
getMaxZoom
float getMaxZoom()
-
setMaxZoom
void setMaxZoom(float maxZoom)
-
getCurrentPage
int getCurrentPage()
-
getCurrentXOffset
float getCurrentXOffset()
-
getCurrentYOffset
float getCurrentYOffset()
-
getZoom
float getZoom()
-
getPageFitPolicy
FitPolicy getPageFitPolicy()
-
setPageFitPolicy
void setPageFitPolicy(FitPolicy pageFitPolicy)
-
setNightMode
void setNightMode(boolean nightMode)
-
setPageSnap
void setPageSnap(boolean pageSnap)
-
getSpacingPx
int getSpacingPx()
-
setPageFling
void setPageFling(boolean pageFling)
-
jumpTo
void jumpTo(int page, boolean withAnimation)
Go to the given page.
- Parameters:
page- Page index.
-
jumpTo
void jumpTo(int page)
-
getPositionOffset
float getPositionOffset()
Get current position as ratio of document length to visible area.0 means that document start is visible, 1 that document end is visible
-
setPositionOffset
void setPositionOffset(float progress, boolean moveHandle)
- Parameters:
progress- must be between 0 and 1moveHandle- whether to move scroll handle
-
setPositionOffset
void setPositionOffset(float progress)
-
stopFling
void stopFling()
-
getPageCount
int getPageCount()
-
setSwipeEnabled
void setSwipeEnabled(boolean enableSwipe)
-
recycle
void recycle()
-
isRecycled
boolean isRecycled()
-
computeScroll
void computeScroll()
Handle fling animation
-
canScrollHorizontally
boolean canScrollHorizontally(int direction)
-
canScrollVertically
boolean canScrollVertically(int direction)
-
loadPages
void loadPages()
Load all the parts around the center of the screen,taking into account X and Y offsets, zoom level, andthe current page displayed
-
onBitmapRendered
void onBitmapRendered(PagePart part)
Called when a rendering task is over anda PagePart has been freshly created.
- Parameters:
part- The created PagePart.
-
moveTo
void moveTo(float offsetX, float offsetY)
-
moveTo
void moveTo(float offsetX, float offsetY, boolean moveHandle)
Move to the given X and Y offsets, but check them ahead of timeto 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
-
performPageSnap
void performPageSnap()
Animate to the nearest snapping position for the current SnapPolicy
-
pageFillsScreen
boolean pageFillsScreen()
-
moveRelativeTo
void 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
void zoomTo(float zoom)
Change the zoom level
-
zoomCenteredTo
void zoomCenteredTo(float zoom, PointF pivot)
Change the zoom level, relatively to a pivot point.It will call moveTo() to make sure the given point staysin the middle of the screen.
- Parameters:
zoom- The zoom level.pivot- The point on the screen that should stays.
-
zoomCenteredRelativeTo
void zoomCenteredRelativeTo(float dzoom, PointF pivot)
-
documentFitsView
boolean documentFitsView()
Checks if whole document can be displayed on screen, doesn't include zoom
-
fitToWidth
void fitToWidth(int page)
-
getPageSize
SizeF getPageSize(int pageIndex)
-
toRealScale
float toRealScale(float size)
-
toCurrentScale
float toCurrentScale(float size)
-
isZooming
boolean isZooming()
-
resetZoom
void resetZoom()
-
resetZoomWithAnimation
void resetZoomWithAnimation()
-
zoomWithAnimation
void zoomWithAnimation(float centerX, float centerY, float scale)
-
zoomWithAnimation
void zoomWithAnimation(float scale)
-
getPageAtPositionOffset
int getPageAtPositionOffset(float positionOffset)
Get page number at given offset
- Parameters:
positionOffset- scroll offset between 0 and 1
-
useBestQuality
void useBestQuality(boolean bestQuality)
-
isBestQuality
boolean isBestQuality()
-
isSwipeVertical
boolean isSwipeVertical()
-
isSwipeEnabled
boolean isSwipeEnabled()
-
enableAnnotationRendering
void enableAnnotationRendering(boolean annotationRendering)
-
isAnnotationRendering
boolean isAnnotationRendering()
-
enableRenderDuringScale
void enableRenderDuringScale(boolean renderDuringScale)
-
isAntialiasing
boolean isAntialiasing()
-
enableAntialiasing
void enableAntialiasing(boolean enableAntialiasing)
-
isAutoSpacingEnabled
boolean isAutoSpacingEnabled()
-
isPageFlingEnabled
boolean isPageFlingEnabled()
-
isFitEachPage
boolean isFitEachPage()
-
isPageSnap
boolean isPageSnap()
-
doRenderDuringScale
boolean doRenderDuringScale()
-
getDocumentMeta
PdfDocument.Meta getDocumentMeta()
Returns null if document is not loaded
-
getTableOfContents
List<PdfDocument.Bookmark> getTableOfContents()
Will be empty until document is loaded
-
fromAsset
PDFView.Configurator fromAsset(String assetName)
Use an asset file as the pdf source
-
fromFile
PDFView.Configurator fromFile(File file)
Use a file as the pdf source
-
fromUri
PDFView.Configurator fromUri(Uri uri)
Use URI as the pdf source, for use with content providers
-
fromBytes
PDFView.Configurator fromBytes(Array<byte> bytes)
Use bytearray as the pdf source, documents is not saved
-
fromStream
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
PDFView.Configurator fromSource(DocumentSource docSource)
Use custom source as pdf source
-
-
-
-