Class PdfReaderView
-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback
,android.view.KeyEvent.Callback
,android.view.ViewManager
,android.view.ViewParent
,android.view.accessibility.AccessibilityEventSource
,com.pspdfkit.internal.document.reflow.ReflowProcessorListener
,com.pspdfkit.ui.PSPDFKitViews.PSPDFView
public class PdfReaderView extends FrameLayout implements PSPDFKitViews.PSPDFView, ReflowProcessorListener
Reader View component containing a styled web view for showing the reflowed text. Reflowing means that the content will be more readable in different device sizes, without requiring a lot of zooming in and out, or scrolling. To inspect the CSS style applied to the web view please refer to the `pspdfkit/reader-view.css` file in the assets folder. This component is disabled by default and requires the reader view license to work.
-
-
Field Summary
Fields Modifier and Type Field Description public boolean
isDisplayed
-
Constructor Summary
Constructors Constructor Description PdfReaderView(Context context)
PdfReaderView(Context context, AttributeSet attrs)
PdfReaderView(Context context, AttributeSet attrs, int defStyleAttr)
PdfReaderView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
-
Method Summary
Modifier and Type Method Description boolean
isDisplayed()
Called when the activity needs to know the visibility of this view. static boolean
doesDeviceSupportReaderView(@NonNull() Context context)
Checks whether PSPDFKit can show `PdfReaderView` on this device. void
setDocument(@NonNull() PdfDocument document, @NonNull() PdfConfiguration configuration)
Called when the document
has been loaded and is going to be displayed.void
addOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Register a listener
that would like to receive visibility change events.void
removeOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Unregister a previously registered listener
that no longer wants to receive visibility change events.void
show()
Shows the outline view (scroll down animation). void
clearDocument()
Called by the activity when the view should unbind the previously set document. PSPDFKitViews.Type
getPSPDFViewType()
Returns the current type of this view. void
hide()
Hides the outline view (scroll up animation). void
progress(int currentPage, int totalPages)
Reports the progress of the reflow operation, giving the current page that is being reflowed and the total number of pages that are being processed at the moment. boolean
isCanceled()
Returns true if the reflow operation has been canceled. -
-
Constructor Detail
-
PdfReaderView
PdfReaderView(Context context)
-
PdfReaderView
PdfReaderView(Context context, AttributeSet attrs)
-
PdfReaderView
PdfReaderView(Context context, AttributeSet attrs, int defStyleAttr)
-
PdfReaderView
PdfReaderView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
-
-
Method Detail
-
isDisplayed
boolean isDisplayed()
Called when the activity needs to know the visibility of this view. Returns
true
if this view is visible, otherwise returnsfalse
.
-
doesDeviceSupportReaderView
@UiThread() static boolean doesDeviceSupportReaderView(@NonNull() Context context)
Checks whether PSPDFKit can show `PdfReaderView` on this device. This checks for availability of the WebView system packages. This method returns
false
, if the WebView package is not installed or has been disabled by the user.Note that this method must be called from the main thread.
- Parameters:
context
- Context used to check installed WebView packages.- Returns:
true
if the conversion is available,false
if not.
-
setDocument
@UiThread() void setDocument(@NonNull() PdfDocument document, @NonNull() PdfConfiguration configuration)
Called when the
document
has been loaded and is going to be displayed. This has to be called on the main thread.- Parameters:
document
- Loaded PdfDocument.configuration
- Containing document and presentation settings.
-
addOnVisibilityChangedListener
void addOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Register a
listener
that would like to receive visibility change events. Whenever the visibility of a managed PSPDFView changes, all registered listeners will be notified.- Parameters:
listener
- Listener to be added.
-
removeOnVisibilityChangedListener
void removeOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Unregister a previously registered
listener
that no longer wants to receive visibility change events.- Parameters:
listener
- Listener to be removed.
-
show
void show()
Shows the outline view (scroll down animation).
-
clearDocument
void clearDocument()
Called by the activity when the view should unbind the previously set document. This may be called in low-memory situations or prior to re-binding another document.
-
getPSPDFViewType
@NonNull() PSPDFKitViews.Type getPSPDFViewType()
Returns the current type of this view.
- Returns:
Any of Type.
-
hide
void hide()
Hides the outline view (scroll up animation).
-
progress
void progress(int currentPage, int totalPages)
Reports the progress of the reflow operation, giving the current page that is being reflowed and the total number of pages that are being processed at the moment.
-
isCanceled
boolean isCanceled()
Returns true if the reflow operation has been canceled.
-
-
-
-