public class QPDFViewerView
extends RelativeLayout
setActivity(Activity)()
after this class is constructed.Modifier and Type | Class and Description |
---|---|
static class |
QPDFViewerView.VIEW_MODE |
Constructor and Description |
---|
QPDFViewerView(Context context) |
QPDFViewerView(Context context,
AttributeSet set) |
QPDFViewerView(Context context,
QPDFViewerView.VIEW_MODE viewMode)
If viewMode is null,
QPDFViewerView.VIEW_MODE.VERTICAL_CONTINUOUS will be used. |
Modifier and Type | Method and Description |
---|---|
void |
addDocumentChangeListener(DocumentChangeListener listener)
Register a listener to receive notifications of changes to the document.
|
void |
addDocumentListener(DocumentListener listener)
Register a listener to receive document events.
|
void |
addPageChangedListener(PageChangedListener listener)
Register a listener to receive page change events.
|
boolean |
clearAnnotationSelection()
De-selects any currently selected Annotations.
|
void |
documentModified()
Deprecated.
|
Activity |
getActivity()
Returns the owner Activity
|
java.lang.String |
getCurrentPageFormat(java.lang.String format)
Returns the currentPageFormat set in
setCurrentPageFormat(String) . |
int |
getCurrentPageNumber()
Getter for the current page number, 1 based.
|
float |
getCurrentScale()
Getter for the viewer's current scale
|
PDFDocument |
getDocument()
Getter for the currently loaded document.
|
float |
getFitToWidth()
Getter for the fit to width scale, the maximum scale at which the document's width will fit within the device's scren.
|
float |
getMaximumScale()
Returns the maximum scale at which the document can be displayed.
|
float |
getMininumScale()
Returns the minimum scale at which the document can be displayed.
|
PDFPageView |
getPageView(int pageIndex)
Returns a view representing the PDFPage for the given pageIndex.
|
PDFPageView |
getPageView(PDFPage page)
Returns a view representing the PDFPage for the given page.
|
PageViewOverlay |
getPageViewOverlay()
Returns the currently set PageViewOverlay.
|
FrameLayout |
getScrollView()
Getter for the application's scroll view
|
LinearLayout |
getSearchToolbar()
Getter for the application search toolbar
|
java.util.Vector<AnnotComponent> |
getSelectedAnnotation()
Returns a Vector of currently selected annotations.
|
ShowNoteHook |
getShowNoteHook()
Returns the current ShowNoteHook.
|
com.qoppa.viewer.utils.TileFactory |
getTileFactory()
Internal method, do not use.
|
Toolbar |
getToolbar()
Getter for the application toolbar
|
Location |
getToolbarLocation()
Returns the current location of the toolbar.
|
QPDFViewerView.VIEW_MODE |
getViewMode()
Returns the current view mode.
|
void |
goToPage(int page)
Navigates to the specified page number in the document.
|
void |
handleAction(Action action)
Performs the specified action.
|
void |
handleActions(java.util.List<Action> actions)
Performs the list of actions.
|
AnnotComponent |
initAnnotComponent(Annotation annot,
View parent)
Initializer which is called when an Annotation is selected.
|
ScrollViewWrapper |
initScrollViewWrapper()
This is called when creating the ScrollViewWrapper for the library.
|
void |
inputPage()
Allows the user to jump to a specific page in the document.
|
void |
inputZoom()
Allows the user to input a specific zoom.
|
boolean |
isNightMode()
Returns true if Night Mode is on.
|
boolean |
isSearchVisible()
Method to test if the text search bar is visible.
|
boolean |
isTouchListenerActive()
Returns true if the touch listener is active.
|
boolean |
isZooming()
Returns true if the user is currently zooming in or out on the document.
|
void |
loadDocument(java.io.InputStream stream)
Opens the pdf document from an
InputStream |
void |
loadDocument(java.lang.String path)
Opens the pdf document at the given file location.
|
void |
loadDocument(java.lang.String path,
int initialPage)
Opens the pdf document at the given file location and opens to the given page
|
void |
nextPage()
Navigates to the next page in the document.
|
void |
onConfigurationChanged(Configuration newConfig) |
void |
onLeftToRightSwipe() |
void |
onRightToLeftSwipe() |
void |
open()
Launches a file browser, allowing users to select a document to open.
|
void |
prevPage()
Navigates to the previous page in the document.
|
void |
redrawCachedAnnots(PDFPageView view)
PDF content is cached so it can be redrawn quickly as the user scrolls.
|
void |
redrawContent()
Content for each PDFPage is cached.
|
void |
redrawContent(PDFPageView view)
Content for each PDFPage is cached.
|
void |
refreshTiles() |
void |
releaseDocument()
This will release all references to the current the document.
|
void |
scrollPdfRectVisible(RectF rect,
int pageIndex)
Scrolls so that a rectangle defined in pdf space is visible.
|
AnnotComponent |
selectAnnotation(Annotation annotation,
int pageIndex)
Selects the given
Annotation . |
void |
setActivity(Activity activity)
The library requires a reference to an
Activity . |
void |
setCurrentPageFormat(java.lang.String format)
By default, the current page is displayed in the toolbar as "i of t" where i is the current page, and t is the total number of pages.
|
void |
setDocument(PDFDocument document)
Releases the currently opened document and replaces it with the given document.
|
void |
setMaximumScale(float scale)
Sets the maximum scale at which the document can be displayed.
|
void |
setMinimumScale(float scale)
Sets the minimum scale at which the document can be displayed.
|
void |
setNightMode(boolean nightOn)
Invert a documents colors by setting Night Mode on.
|
void |
setOnGestureListener(OnGestureListenerExt gestureListener)
QPDFViewerView handles gestures to provide a variety of functionality (zooming, scrolling, paning, etc..).
|
void |
setPageViewOverlay(PageViewOverlay overlay)
The PageViewOverlay can be used to additional content on top of PDFPageViews.
|
void |
setScale(float scale)
Set the viewer scale.
|
void |
setShowNoteHook(ShowNoteHook showNoteHook)
By default, when selected Annotations are double tapped their Note/Comment is displayed as a toast.
|
void |
setShowProgressDialog(boolean showProgressDialog) |
void |
setToolbarLocation(Location location)
Setter for the toolbar location.
|
void |
setTouchListenerActive(boolean active)
When set to false, all touch events (zooming, scrolling, etc...) will be ignored.
|
void |
showHideSearch()
Shows or hides the text search bar.
|
void |
showHideToolbar()
Shows or hides the button toolbar.
|
void |
zoomIn(PointF center)
Zoom in on the given point.
|
void |
zoomOut(PointF center)
Zoom out on the given point.
|
public QPDFViewerView(Context context)
public QPDFViewerView(Context context, AttributeSet set)
public QPDFViewerView(Context context, QPDFViewerView.VIEW_MODE viewMode)
QPDFViewerView.VIEW_MODE.VERTICAL_CONTINUOUS
will be used.public void setActivity(Activity activity)
Activity
. This setter must be called prior to interacting with QPDFViewerView
.activity
- An owner activitypublic Activity getActivity()
public void onConfigurationChanged(Configuration newConfig)
public void open()
public void showHideSearch()
public boolean isSearchVisible()
public void showHideToolbar()
public void zoomIn(PointF center)
center
- A PointF
to center aroundpublic void zoomOut(PointF center)
center
- A PointF
to center aroundpublic void setScale(float scale)
scale
- The scale to set the viewer topublic void inputPage()
public void inputZoom()
public void prevPage()
public void nextPage()
public void goToPage(int page)
public void loadDocument(java.lang.String path)
path
- The path to the pdf filepublic void loadDocument(java.lang.String path, int initialPage)
path
- The path to the pdf fileinitialPage
- The 0 based page index of the page to display upon document loadpublic void releaseDocument()
public void loadDocument(java.io.InputStream stream)
InputStream
stream
- The pdf document streampublic Toolbar getToolbar()
public LinearLayout getSearchToolbar()
public FrameLayout getScrollView()
public float getCurrentScale()
public float getFitToWidth()
public PDFDocument getDocument()
PDFDocument
public int getCurrentPageNumber()
public void redrawContent()
public void redrawContent(PDFPageView view)
pageIndex
- The 0 based index for the page to re-cachepublic void redrawCachedAnnots(PDFPageView view)
Link
, RubberStamp
, and Widget
with the exception of WidgetSignature
which are not cached.view
- The PDFPageView for the page whose annotations need to be redrawnpublic void handleActions(java.util.List<Action> actions)
actions
- A list of actions to handlepublic void handleAction(Action action)
action
- An action to handlepublic AnnotComponent selectAnnotation(Annotation annotation, int pageIndex)
Annotation
. Also de-selects any currently selected annotations.annotation
- The Annotation to selectpageIndex
- Index of the Annotation's parent page, 0 basedpublic void scrollPdfRectVisible(RectF rect, int pageIndex)
rect
- The rectangle in pdf spacepageIndex
- The index of the page to scroll topublic java.util.Vector<AnnotComponent> getSelectedAnnotation()
public boolean clearAnnotationSelection()
@Deprecated public void documentModified()
redrawContent()
public void addDocumentListener(DocumentListener listener)
listener
- public void addPageChangedListener(PageChangedListener listener)
listener
- public void addDocumentChangeListener(DocumentChangeListener listener)
listener
- public ScrollViewWrapper initScrollViewWrapper()
public void setToolbarLocation(Location location)
a
- Location
public Location getToolbarLocation()
Location
public AnnotComponent initAnnotComponent(Annotation annot, View parent)
public void setDocument(PDFDocument document)
document
- public void setShowProgressDialog(boolean showProgressDialog)
public void onRightToLeftSwipe()
public void onLeftToRightSwipe()
public com.qoppa.viewer.utils.TileFactory getTileFactory()
public void setTouchListenerActive(boolean active)
active
- public boolean isTouchListenerActive()
public PDFPageView getPageView(int pageIndex)
public PDFPageView getPageView(PDFPage page)
public void setOnGestureListener(OnGestureListenerExt gestureListener)
public void setPageViewOverlay(PageViewOverlay overlay)
overlay
- An instance of PageViewOverlaypublic PageViewOverlay getPageViewOverlay()
public void setMinimumScale(float scale)
getFitToWidth()
.scale
- The minimum scale, should be > 0.public void setMaximumScale(float scale)
scale
- The maximum scale, should be > 0.public float getMaximumScale()
public float getMininumScale()
public void setCurrentPageFormat(java.lang.String format)
public java.lang.String getCurrentPageFormat(java.lang.String format)
setCurrentPageFormat(String)
. If not format has been set, returns null.public QPDFViewerView.VIEW_MODE getViewMode()
QPDFViewerView.VIEW_MODE
public boolean isZooming()
public void setShowNoteHook(ShowNoteHook showNoteHook)
public ShowNoteHook getShowNoteHook()
setShowNoteHook(ShowNoteHook)
has not been called.public void setNightMode(boolean nightOn)
refreshTiles()
to re-render any cached renderings.nightOn
- True to invert colors, False by default.public boolean isNightMode()
public void refreshTiles()