java.lang.Object | |||
↳ | android.view.View | ||
↳ | android.view.ViewGroup | ||
↳ | com.pdftron.pdf.PDFViewCtrl |
PDFViewCtrl is derived from android.view.ViewGroup and encapsulates a rich set of functionalities for interactive viewing of PDF documents.
PDFViewCtrl makes use of PDFTron's PDFNet library that is compiled as a native library to ensure real-time viewing experience. It provides a comprehensive set of functionalities, including multi-threaded rendering, PDF rendering settings, scrolling, zooming, page navigation, different page viewing modes, coordinates conversion, text selection, text search, etc. In addition, PDFViewCtrl also allows for extension to accommodate a user's specific needs, which can be achieved in one of the following two ways:
PDFViewCtrl.ToolManager
interface. This interface provides a way for users to interact with
PDFViewCtrl, including customizing responses to gestures and drawing extra
contents on top of the PDF content. In fact, Apryse SDK also ships with a
separate library (Tools), that is programmed via this interface. This
library utilizes functions offered by PDFNet and implements several
ready-to-use UI modules such as annotation editing, text selection, text
search, page navigation, etc.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | PDFViewCtrl.ActionCompletedListener | Callback interface invoked when an action is completed | |||||||||
enum | PDFViewCtrl.AnnotationManagerMode | An enum represents annotation manager mode | |||||||||
enum | PDFViewCtrl.ConversionState | An enum represents document conversion state | |||||||||
interface | PDFViewCtrl.DocumentDownloadListener | Used for receiving updates from document downloading, which can be
started by openUrlAsync(String, String, String, HTTPRequestOptions)
|
|||||||||
interface | PDFViewCtrl.DocumentLoadListener | Used for receiving notifications about the document state. | |||||||||
enum | PDFViewCtrl.DownloadState | An enum represents document download state | |||||||||
interface | PDFViewCtrl.ErrorReportListener | Used for receiving error reports in case an error is encountered during page rendering. | |||||||||
class | PDFViewCtrl.HTTPRequestOptions | Class for customizing network requests. | |||||||||
class | PDFViewCtrl.LinkInfo | A class that holds information for a link. | |||||||||
interface | PDFViewCtrl.LockRunnable | Runnable used in conjunction with document locking helper methods. | |||||||||
interface | PDFViewCtrl.OnCanvasSizeChangeListener | Used for tracking current canvas size changes | |||||||||
enum | PDFViewCtrl.OverPrintMode | Overprint mode. | |||||||||
interface | PDFViewCtrl.PageChangeListener | Used for receiving notifications in UI thread when the current page changes. | |||||||||
enum | PDFViewCtrl.PageChangeState | State of page changes. | |||||||||
enum | PDFViewCtrl.PagePresentationMode | Page presentation mode | |||||||||
interface | PDFViewCtrl.PageSlidingListener | Used for receiving events when PDFViewCtrl undergoes page sliding transformation. | |||||||||
enum | PDFViewCtrl.PageViewMode | Page view mode | |||||||||
enum | PDFViewCtrl.PriorEventMode | Prior event mode | |||||||||
interface | PDFViewCtrl.RenderingListener | Used for receiving notifications of the start and end of the rendering of the client area. | |||||||||
class | PDFViewCtrl.Selection | Class that represents the current text selection by PDFViewCtrl. | |||||||||
interface | PDFViewCtrl.TextSearchListener | Used for receiving notifications in UI thread during the process of text search. | |||||||||
enum | PDFViewCtrl.TextSearchResult | Text search result state | |||||||||
enum | PDFViewCtrl.TextSelectionMode | Text selection mode | |||||||||
interface | PDFViewCtrl.ThumbAsyncListener | Used for receiving events from a request for thumbnails. | |||||||||
interface | PDFViewCtrl.ToolManager | Tool manager interface that is used for creating tools. | |||||||||
interface | PDFViewCtrl.UniversalDocumentConversionListener | Used for receiving updates from universal document conversion when document are opened by
by openUniversalDocument(DocumentConversion) . |
|||||||||
interface | PDFViewCtrl.UniversalDocumentProgressIndicatorListener | Used for receiving notifications of the current blank page whose content generation is in progress. | |||||||||
enum | PDFViewCtrl.ZoomLimitMode | Zoom limit mode. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
double | SCROLL_ZOOM_FACTOR |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.ViewGroup
| |||||||||||
From class
android.view.View
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static int | DEFAULT_BG_COLOR | ||||||||||
public static int | DEFAULT_DARK_BG_COLOR |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.View
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PDFViewCtrl(Context context, AttributeSet attrs)
Constructor that is called when inflating a view from XML.
| |||||||||||
PDFViewCtrl(Context context, AttributeSet attrs, int defStyle)
Perform inflation from XML and apply a class-specific base style.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addDocumentDownloadListener(PDFViewCtrl.DocumentDownloadListener listener)
Adds the document download listener.
| ||||||||||
void |
addDocumentLoadListener(PDFViewCtrl.DocumentLoadListener listener)
Adds the document load listener.
| ||||||||||
void |
addOnCanvasSizeChangeListener(PDFViewCtrl.OnCanvasSizeChangeListener listener)
Add a listener that will be called when the canvas size of the view change due to
layout processing.
| ||||||||||
void |
addPageChangeListener(PDFViewCtrl.PageChangeListener listener)
Add the page change listener
| ||||||||||
void | addPageSlidingListener(PDFViewCtrl.PageSlidingListener listener) | ||||||||||
void |
addTextSearchListener(PDFViewCtrl.TextSearchListener listener)
Adds the text search listener.
| ||||||||||
void |
addThumbAsyncListener(PDFViewCtrl.ThumbAsyncListener listener)
Adds a listener to get events from
getThumbAsync(int) . | ||||||||||
void |
addUniversalDocumentConversionListener(PDFViewCtrl.UniversalDocumentConversionListener listener)
Adds the document conversion listener
| ||||||||||
boolean |
canGotoNextPage()
Checks if can set the current page to the next page.
| ||||||||||
boolean |
canGotoPreviousPage()
Checks if can set the current page to the previous page.
| ||||||||||
boolean |
canRedo()
Returns true if redo operation is available.
| ||||||||||
boolean | canScrollHorizontally(int direction) | ||||||||||
boolean |
canUndo()
Returns true if undo operation is available.
| ||||||||||
void |
cancelAllThumbRequests()
Cancels all thumbnail requests initiated by
getThumbAsync(int) . | ||||||||||
void |
cancelFindText()
Cancels the current text search thread, if exists.
| ||||||||||
void |
cancelRendering()
Cancels the rendering thread, if running.
| ||||||||||
void | cancelRenderingAsync() | ||||||||||
void |
clearSelection()
Removes all text
PDFViewCtrl.Selection . | ||||||||||
void |
clearThumbCache()
Clear the thumbnail cache.
| ||||||||||
void |
closeDoc()
Closes the current document.
| ||||||||||
void |
closeTool()
Closes the current tool.
| ||||||||||
void |
computeScroll()
The overloaded implementation of
View.computeScroll() . | ||||||||||
double[] |
convCanvasPtToPagePt(double x, double y, int page_num)
Converts a point in canvas space to the specified page space.
| ||||||||||
double[] |
convCanvasPtToPagePt(double x, double y)
Converts a point in canvas space to the current page space.
| ||||||||||
double[] |
convCanvasPtToScreenPt(double x, double y, int pageNumber)
Converts a point expressed in canvas space to a point in screen space.
| ||||||||||
double[] |
convCanvasPtToScreenPt(double x, double y)
Converts a point expressed in canvas space to a point in screen space.
| ||||||||||
double[] | convHorizontalScrollingPtToPagePt(double x, double y, int page_num) | ||||||||||
double[] |
convPagePtToCanvasPt(double x, double y, int page_num)
Converts a point in the specified page space to canvas space.
| ||||||||||
double[] |
convPagePtToCanvasPt(double x, double y)
Converts a point in the current page space to canvas space.
| ||||||||||
double[] |
convPagePtToHorizonalScrollingPt(double x, double y, int page_num)
Converts a point from a page space to horizontal scrollable region space.
| ||||||||||
double[] |
convPagePtToHorizontalScrollingPt(double x, double y, int page_num)
Converts a point from a page space to horizontal scrollable region space.
| ||||||||||
double[] |
convPagePtToScreenPt(double x, double y, int page_num)
Converts a point from a page space to a point in screen space.
| ||||||||||
double[] |
convScreenPtToCanvasPt(double x, double y, int pageNumber)
Converts a point expressed in screen space to a point in (PDF) canvas space.
| ||||||||||
double[] |
convScreenPtToCanvasPt(double x, double y)
Converts a point expressed in screen space to a point in (PDF) canvas space.
| ||||||||||
double[] |
convScreenPtToPagePt(double x, double y, int page_num)
Converts a point expressed in screen space to a point on a page space.
| ||||||||||
double[] |
convScreenPtToPagePt(double x, double y)
Converts a point expressed in screen space to a point on a page space.
| ||||||||||
void |
destroy()
Should be called in android.app.Activity.onDestroy() to destroy
PDFViewCtrl and clean up memory and used resources.
| ||||||||||
void |
docLock(boolean cancel_rendering)
Locks the PDFDoc instance used by PDFViewCtrl.
| ||||||||||
void |
docLock(boolean cancel_rendering, PDFViewCtrl.LockRunnable runnable)
Synchronously runs the code block defined in the Runnable while holding a write lock on the
PDFDoc instance used by PDFViewCtrl.
| ||||||||||
void |
docLockRead(PDFViewCtrl.LockRunnable runnable)
Synchronously runs the code block defined in the Runnable while holding a read lock on the
PDFDoc instance used by PDFViewCtrl.
| ||||||||||
void |
docLockRead()
Locks the PDFDoc instance used by PDFViewCtrl for reading.
| ||||||||||
boolean |
docTryLock(int milliseconds)
Try acquiring a write lock on the currently open document, waiting no longer than specified
number of milliseconds.
| ||||||||||
boolean |
docTryLockRead(int milliseconds)
Try acquiring a read lock on the current document, waiting no longer than specified number
of milliseconds.
| ||||||||||
boolean |
docUnlock()
Unlocks the PDFDoc instance used by PDFViewCtrl and restarts the
rendering thread if it was canceled by calling
docLock(boolean) . | ||||||||||
boolean |
docUnlockRead()
Removes the read lock from the PDFDoc instance used by PDFViewCtrl.
| ||||||||||
void |
enableAnnotationLayer()
Enable separate rendering layer for annotations.
| ||||||||||
ExternalAnnotManager | enableExternalAnnotManager(String author_name) | ||||||||||
ExternalAnnotManager | enableExternalAnnotManager(String author_name, PDFViewCtrl.AnnotationManagerMode mode) | ||||||||||
void |
enableUndoRedo()
Enable Undo/Redo in this PDFview.
| ||||||||||
void |
executeAction(ActionParameter action_param)
Executes the action.
| ||||||||||
void |
executeAction(Action action)
Executes the action.
| ||||||||||
void |
findText(String search_str, boolean match_case, boolean match_whole_word, boolean search_up, boolean reg_exp, int page_num)
Searches asynchronously, starting from the current page, for the given
text.
| ||||||||||
void |
findText(String search_str, boolean match_case, boolean match_whole_word, boolean search_up, boolean reg_exp)
Searches asynchronously, starting from the current page, for the given
text.
| ||||||||||
void |
forceFinishFling()
Forces the PDFViewCtrl to immediately stop the flinging action.
| ||||||||||
long[] |
getAllCanvasPixelSizes()
Returns the size of the scrollable spaces for all canvases.
| ||||||||||
int |
getAnnotTypeUnder(double x, double y)
Gets annotation type at the given point
| ||||||||||
Annot |
getAnnotationAt(int x, int y)
Gets the annotation at the (x, y) position expressed in screen coordinates.
| ||||||||||
Annot |
getAnnotationAt(int x, int y, double distanceThreshold, double minimumLineWeight)
Gets the annotation at the (x, y) position expressed in screen coordinates.
| ||||||||||
ArrayList<Annot> |
getAnnotationListAt(int x1, int y1, int x2, int y2)
Gets the list of annotations at line (x1, y1, x2, y2) expressed in screen coordinates
| ||||||||||
CurvePainter | getAnnotationPainter(int page_num, long annot_key) | ||||||||||
ArrayList<Annot> |
getAnnotationsOnPage(int page_num)
Gets the list of annotations on a given page.
| ||||||||||
double |
getCanvasHeight()
Returns the height of Zoomed PDF Canvas Space.
| ||||||||||
double |
getCanvasWidth()
Returns the width of Zoomed PDF Canvas Space.
| ||||||||||
int |
getClientBackgroundColor()
Gets the background color of the client area.
| ||||||||||
int | getColorPostProcessMode() | ||||||||||
void |
getContentSize(int[] size)
Gets the size of the actual content in the current canvas
meaning all pages, as well as gaps and padding set by setPageSpacing
| ||||||||||
int | getCurCanvasId() | ||||||||||
PointF | getCurrentMousePosition() | ||||||||||
int |
getCurrentPage()
Gets the current page number.
| ||||||||||
Matrix2D |
getDeviceTransform(int page_num)
Gets the device transformation matrix.
| ||||||||||
Matrix2D |
getDeviceTransform()
Gets the device transformation matrix.
| ||||||||||
boolean | getDirectionalLockEnabled() | ||||||||||
int |
getDisplayCutoutBottom()
Gets the bottom display cutout height
| ||||||||||
int |
getDisplayCutoutTop()
Gets the top display cutout height
| ||||||||||
PDFDoc |
getDoc()
Gets the current PDF document.
| ||||||||||
ExternalAnnotManager |
getExternalAnnotManager()
Gets the external annot manager belonging to this PDFViewCtrl
| ||||||||||
int |
getHScrollPos()
Gets the current horizontal scroll position.
| ||||||||||
PDFViewCtrl.LinkInfo |
getLinkAt(int x, int y)
Gets the link info at a given point, specified in screen space.
| ||||||||||
boolean |
getLongPressEnabled()
Gets if PdfViewCtrl can read long press event
| ||||||||||
String |
getNextRedoInfo()
Returns any meta-data associated with the next sate in the undo/redo chain.
| ||||||||||
String |
getNextUndoInfo()
Returns any meta-data associated with the previous sate in the undo/redo chain.
| ||||||||||
Context |
getOCGContext()
Gets the OCG context.
| ||||||||||
int |
getPageBox()
Gets the box used by PDFViewCtrl for rasterizing.
| ||||||||||
int |
getPageCount()
Gets the page count.
| ||||||||||
int |
getPageNumberFromScreenPt(double x, double y)
Gets the number of the page on which the specified point in screen space.
| ||||||||||
PDFViewCtrl.PagePresentationMode |
getPagePresentationMode()
Gets the current page presentation mode.
| ||||||||||
Rect |
getPageRectForAnnot(Annot annot, int page_num)
Gets the annotation bounding box in page coordinates
| ||||||||||
PDFViewCtrl.PageViewMode |
getPageRefViewMode()
Gets the reference page view mode.
| ||||||||||
int |
getPageRotation()
Gets the current rotation applied to all pages in PDFViewCtrl.
| ||||||||||
Matrix |
getPageSlidingCanvasTransform()
Gets the extra transformation matrix applied to the
android.graphics.Canvas object used by PDFViewCtrl during page sliding.
| ||||||||||
PDFViewCtrl.PageViewMode |
getPageViewMode()
Gets the current page viewing mode.
| ||||||||||
ColorPt |
getPostProcessedColor(ColorPt cp)
Convert a color based on the defined post processing transformation in
setColorPostProcessMapFile(Filter) . | ||||||||||
PDFViewCtrl.PageViewMode |
getPreferredViewMode()
Gets the preferred view mode when maintain zoom level is enabled
| ||||||||||
boolean |
getProgressiveRendering()
Checks if progressive rendering is used.
| ||||||||||
boolean |
getQuickScaleEnabled()
Gets if PdfViewCtrl can dispatch quick scale event
| ||||||||||
boolean |
getRightToLeftLanguage()
Checks if PDFViewCtrl thinks the content in the viewed PDF document reads
from right to left.
| ||||||||||
Rect |
getScreenRectForAnnot(Annot annot, int page_num)
Gets the annotation bounding box in screen coordinates
| ||||||||||
int | getScrollOffsetForCanvasId(int canvasId) | ||||||||||
int | getScrollXOffsetInTools(int pageNum) | ||||||||||
int | getScrollYOffsetInTools(int pageNum) | ||||||||||
PDFViewCtrl.Selection |
getSelection(int page)
Gets the text
PDFViewCtrl.Selection on a given page. | ||||||||||
int |
getSelectionBeginPage()
Returns the first page number that has text
PDFViewCtrl.Selection on it. | ||||||||||
int |
getSelectionEndPage()
Returns the last page number that has text
PDFViewCtrl.Selection on it. | ||||||||||
int | getSlidingScrollX() | ||||||||||
int | getSlidingScrollY() | ||||||||||
void |
getThumbAsync(int page_num)
This will request a thumbnail for the given page number.
| ||||||||||
PDFViewCtrl.ToolManager |
getToolManager()
Gets the
PDFViewCtrl.ToolManager instance used by PDFViewCtrl. | ||||||||||
int |
getVScrollPos()
Gets the current vertical scroll position.
| ||||||||||
int |
getViewCanvasHeight()
Returns the height of PDFViewCtrl Canvas space.
| ||||||||||
int |
getViewCanvasWidth()
Returns the width of PDFViewCtrl Canvas space.
| ||||||||||
int[] |
getVisiblePages()
Gets an array with the pages currently visible on the screen.
| ||||||||||
int[] |
getVisiblePagesInTransition()
Gets an array with the pages currently visible on the screen.
| ||||||||||
double |
getZoom()
Gets the current zoom factor.
| ||||||||||
boolean | getZoomEnabled() | ||||||||||
double |
getZoomForViewMode(PDFViewCtrl.PageViewMode viewMode)
Calculates the zoom for the current view if it was currently in the view mode set by
setPageViewMode(PageViewMode) with viewMode | ||||||||||
boolean |
gotoFirstPage()
Sets the current page to the first page.
| ||||||||||
boolean |
gotoLastPage()
Sets the current page to the last page.
| ||||||||||
void | gotoNextPage(boolean animated) | ||||||||||
boolean |
gotoNextPage()
Sets the current page to the next page.
| ||||||||||
boolean |
gotoPreviousPage()
Sets the current page to the previous page.
| ||||||||||
void | gotoPreviousPage(boolean animated) | ||||||||||
boolean |
hasSelection()
Checks if there is any text
PDFViewCtrl.Selection . | ||||||||||
boolean |
hasSelectionOnPage(int page)
Checks if there is any text
PDFViewCtrl.Selection on a given page. | ||||||||||
void |
hideAnnotation(Annot annot)
Disable rendering of a particular annotation.
| ||||||||||
boolean | isAnnotationLayerEnabled() | ||||||||||
boolean |
isContinuousPagePresentationMode(PDFViewCtrl.PagePresentationMode mode)
Utility function that checks if the page presentation mode is continuous.
| ||||||||||
boolean | isCurrentSlidingCanvas(int pageNum) | ||||||||||
boolean | isDuringFling() | ||||||||||
boolean |
isFacingPagePresentationMode(PDFViewCtrl.PagePresentationMode mode)
Utility function that checks if the page presentation mode is facing.
| ||||||||||
boolean |
isFinishedRendering(boolean visible_region_only)
Checks if the rendering thread finishes or the current visible region has
been fully rendered.
| ||||||||||
boolean |
isFinishedRendering()
Checks if the rendering thread has finished.
| ||||||||||
boolean |
isHardwareAccelerated()
Checks if PDFViewCtrl is hardware accelerated.
| ||||||||||
boolean | isMaintainZoomEnabled() | ||||||||||
boolean |
isSlidingWhileZoomed()
Gets whether the viewer is currently in horizontal page transition mode
while the current canvas is zoomed in before the sliding happens
| ||||||||||
boolean |
isStylusScaleEnabled()
Get whether stylus should zoom when the primary stylus button is held.
| ||||||||||
boolean |
isThereTextInRect(double x1, double y1, double x2, double y2)
Checks if in the given region there is any text.
| ||||||||||
boolean | isUndoRedoEnabled() | ||||||||||
boolean |
isValid()
Checks if PDFViewCtrl is valid.
| ||||||||||
boolean | isZoomingInAddingAnnotationEnabled() | ||||||||||
Rect |
jumpToAnnotOnPage(Annot annot, int pageNum)
Changes the viewing area to fit an annotation.
| ||||||||||
Rect | jumpToAnnotWithID(String annotId) | ||||||||||
void |
onConfigurationChanged(Configuration newConfig)
Call this method to trigger the Tools' onConfigurationChanged event.
| ||||||||||
boolean |
onGenericMotionEvent(MotionEvent event)
The overloaded implementation of
View.onGenericMotionEvent(MotionEvent) . | ||||||||||
boolean |
onKeyUp(int keyCode, KeyEvent event)
Notified when a key was released.
| ||||||||||
boolean |
onTouchEvent(MotionEvent event)
The overloaded implementation of android.view.onTouchEvent().
| ||||||||||
DocumentConversion |
openNonPDFFilter(SecondaryFileFilter fileFilter, ConversionOptions options)
Utility function for opening a non-PDF document for display.
| ||||||||||
DocumentConversion |
openNonPDFUri(Uri fileUri, ConversionOptions options)
Utility function for opening a non-PDF document for display.
| ||||||||||
PDFDoc |
openPDFFilter(SecondaryFileFilter fileFilter, String password)
Utility function for opening a PDF document for display.
| ||||||||||
PDFDoc |
openPDFUri(Uri fileUri, String password, String cachePath, PDFViewCtrl.HTTPRequestOptions httpRequestOptions)
Utility function for opening a PDF document for display.
| ||||||||||
PDFDoc |
openPDFUri(Uri fileUri, String password)
Utility function for opening a PDF document for display.
| ||||||||||
void |
openUniversalDocument(DocumentConversion conversion)
Sets the PDF document to be displayed.
| ||||||||||
void |
openUrlAsync(String url, String cachePdf, String password, PDFViewCtrl.HTTPRequestOptions options)
Sets the PDF document, from a URL, that is to be displayed.
| ||||||||||
void |
pause()
Should be called in android.app.Activity.onPause() to pause PDFViewCtrl.
| ||||||||||
void |
postCustomEvent(Object obj)
Posts a message to cause
onCustomEvent(Object) to be
called in the next main message loop. | ||||||||||
void |
prepareAnnotsForMouse(int pageNum, double distanceThreshold, double minimumLineWeight)
Requests for preparing annotations of the given page.
| ||||||||||
void |
prepareAnnotsForMouse(int pageNum)
Requests for preparing annotations of the given page.
| ||||||||||
void |
prepareWords(int pageNum)
Requests for preparing words of the given page.
| ||||||||||
void |
purgeMemory()
Call this method to lower PDFViewCtrl's memory consumption, such as in
Activity.onLowMemory().
| ||||||||||
void |
purgeMemoryDueToOOM()
it is a good practice in your code to catch OutOfMemoryError exception and
then call this method.
| ||||||||||
static String | readStream(InputStream in) | ||||||||||
String |
redo()
Go to the next state in the undo/redo chain.
| ||||||||||
void |
refreshAndUpdate(ViewChangeCollection view_change)
Helper function that will refresh annotation and/or field appearances if needed, and then
render modified page areas, all based on the contents of the view_change parameter.
| ||||||||||
void |
removeDocumentDownloadListener(PDFViewCtrl.DocumentDownloadListener listener)
Removes the document download listener.
| ||||||||||
void |
removeDocumentLoadListener(PDFViewCtrl.DocumentLoadListener listener)
Removes the document load listener.
| ||||||||||
void |
removeOnCanvasSizeChangeListener(PDFViewCtrl.OnCanvasSizeChangeListener listener)
Removes the canvas size change listener.
| ||||||||||
void |
removePageChangeListener(PDFViewCtrl.PageChangeListener listener)
Remove Page change listener
| ||||||||||
void | removePageSlidingListener(PDFViewCtrl.PageSlidingListener listener) | ||||||||||
void |
removeTextSearchListener(PDFViewCtrl.TextSearchListener listener)
Removes the text search listener.
| ||||||||||
void |
removeThumbAsyncListener(PDFViewCtrl.ThumbAsyncListener listener)
Removes thumb async listener.
| ||||||||||
void |
removeUniversalDocumentConversionListener(PDFViewCtrl.UniversalDocumentConversionListener listener)
Removes the document conversion listener
| ||||||||||
void |
requestLayout()
Overloaded version of android.view.View.requestLayout().
| ||||||||||
void |
requestRendering()
Requests that PDFViewCtrl start rendering, if necessary.
| ||||||||||
void |
resume()
Should be called in android.app.Activity.onResume() to resume PDFViewCtrl.
| ||||||||||
void |
revertAllChanges()
Returns to the initial state in the undo/redo chain
| ||||||||||
void |
rotateClockwise()
Rotates all pages in the document 90 degrees clockwise.
| ||||||||||
void |
rotateCounterClockwise()
Rotates all pages in the document 90 degrees counter-clockwise.
| ||||||||||
void |
scrollBy(int dx, int dy)
Overloaded implementation of android.view.View.scrollBy().
| ||||||||||
void |
scrollTo(int x, int y)
Overloaded implementation of android.view.View.scrollTo().
| ||||||||||
boolean |
select(double x1, double y1, double x2, double y2)
Selects text within the given region using the current text selection
mode.
| ||||||||||
boolean |
select(double x1, double y1, int page1, double x2, double y2, int page2)
Selects text using structural mode.
| ||||||||||
void |
selectAll()
Selects all the text in the document.
| ||||||||||
boolean |
selectAndJumpWithHighlights(Highlights highlights)
Selects texts identified by Highlights.
| ||||||||||
boolean |
selectByRect(double x1, double y1, double x2, double y2)
Selects text within the given region using rectangular selection
mode.
| ||||||||||
boolean |
selectByStructWithSmartSnapping(double x1, double y1, double x2, double y2)
Selects text within the given region using structural text selection mode
and with smart snapping.
| ||||||||||
boolean |
selectByStructWithSnapping(double x1, double y1, double x2, double y2, boolean snap_to_start, boolean snap_to_end)
Selects text within the given region using the current text selection mode with defined snap-to-start and snap-to-end modes.
| ||||||||||
boolean |
selectWithHighlights(Highlights highlights)
Selects texts identified by Highlights.
| ||||||||||
boolean |
selectWithSelection(PDFViewCtrl.Selection sel)
Selects texts identified by Selection.
| ||||||||||
void |
setActionCompletedListener(PDFViewCtrl.ActionCompletedListener listener)
Sets action completed listener.
| ||||||||||
void |
setAntiAliasing(boolean enable_aa)
Enables or disables anti-aliasing.
| ||||||||||
void |
setBuiltInPageSlidingAnimationDuration(int animationDuration)
Sets the parameter of built-in page turning effect.
| ||||||||||
void |
setBuiltInPageSlidingEnabled(boolean enabled)
Enables or disables the built-in page turning animation effect (sliding) when
it is under non-continuous page presentation mode (
setPagePresentationMode(PagePresentationMode) ). | ||||||||||
void |
setBuiltInPageSlidingState(boolean state)
Sets the current state of page slider.
| ||||||||||
void |
setBuiltInPageSlidingThreshSpeed(int fling_dp_per_second)
Sets the parameter of built-in page turning effect.
| ||||||||||
void |
setBuiltInZoomAnimationDuration(int animationDuration)
Sets the parameter of zoom animation effect.
| ||||||||||
void |
setCaching(boolean enabled)
Enables or disables caching.
| ||||||||||
void |
setClientBackgroundColor(int r, int g, int b, boolean transparent)
Sets the background color of the client area.
| ||||||||||
void |
setColorPostProcessColors(int whiteColor, int blackColor)
Sets the color post processing transformation.
| ||||||||||
void |
setColorPostProcessMapFile(Filter image_file_contents)
Sets the color post processing transformation.
| ||||||||||
void |
setColorPostProcessMode(int mode)
Sets the color post processing transformation.
| ||||||||||
boolean |
setCurrentPage(int page_num)
Goes to the specified page.
| ||||||||||
void | setDebug(boolean debug) | ||||||||||
void |
setDefaultPageColor(int c)
Sets the default 'paper' color used to draw background of each page.
| ||||||||||
void |
setDefaultPageColor(int r, int g, int b)
Sets the default 'paper' color used to draw background of each page.
| ||||||||||
void |
setDevicePixelDensity(double dpi, double scale_factor)
Sets device dpi
| ||||||||||
void | setDirectionalLockEnabled(boolean enabled) | ||||||||||
void |
setDisplayCutout(int top, int bottom)
Sets the display cutout
| ||||||||||
void |
setDoc(PDFDoc doc)
Sets the PDF document to be displayed.
| ||||||||||
void |
setDrawAnnotations(boolean render_annots)
Enables or disables annotation and forms rendering.
| ||||||||||
void |
setErrorReportListener(PDFViewCtrl.ErrorReportListener listener)
Sets the error report listener.
| ||||||||||
void |
setFieldHighlightColor(ColorPt cp)
Set the highlight color for fields
This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`. | ||||||||||
void |
setGamma(double exp)
Sets the gamma factor used for anti-aliased rendering.
| ||||||||||
void |
setHScrollPos(int pos)
Sets the horizontal scroll position.
| ||||||||||
void |
setHighlightFields(boolean highlight_fields)
Enable or disable highlighting form fields.
| ||||||||||
void |
setHorizontalAlign(int align)
Sets the horizontal alignment used for rendering pages within the view.
| ||||||||||
void |
setImageSmoothing(boolean smoothing)
Sets if image smoothing is used.
| ||||||||||
void |
setInteractionEnabled(boolean enabled)
Enable or disable user input for PDFViewCtrl.
| ||||||||||
void |
setLongPressEnabled(boolean enable)
Sets if PdfViewCtrl can dispatch long press event
| ||||||||||
void | setMaintainZoomEnabled(boolean enabled) | ||||||||||
void |
setMinimumRefZoomForMaximumZoomLimit(double required_zoom)
Sets the minimum ref zoom used for calculating the maximum zoom limit when using relative zoom limits.
| ||||||||||
void |
setNextOnLayoutAdjustments(int extra_scroll_x, int extra_scroll_y, boolean animateZoomLimitsIfNecessary)
Adjusts the position of PDFViewCtrl content.
| ||||||||||
void |
setOCGContext(Context ctx)
Sets the Optional Content Group (OCG) context that should be used when
viewing the document.
| ||||||||||
void |
setOverprint(PDFViewCtrl.OverPrintMode overprint)
Enables or disables support for overprint.
| ||||||||||
void |
setPageBorderVisibility(boolean borderVisibility)
Enables or disables drawing of a thin border around each page.
| ||||||||||
void |
setPageBox(int region)
Selects the PageBox to rasterize.
| ||||||||||
void |
setPagePresentationMode(PDFViewCtrl.PagePresentationMode mode)
Sets the page presentation mode.
| ||||||||||
void |
setPageRefViewMode(PDFViewCtrl.PageViewMode mode)
Sets the reference page view mode.
| ||||||||||
void |
setPageSpacing(int horiz_col_space, int vert_col_space, int horiz_pad, int vert_pad)
Sets the padding for PDFViewCtrl,
as well as vertical and horizontal padding and column spacing
between adjacent pages in the view.
| ||||||||||
void |
setPageSpacingDP(int horiz_col_space, int vert_col_space, int horiz_pad, int vert_pad)
Sets the vertical and horizontal padding and column spacing between
adjacent pages in the view.
| ||||||||||
void |
setPageTransparencyGrid(boolean trans_grid_visible)
Enables or disables the transparency grid (check board pattern) to reflect page transparency.
| ||||||||||
void |
setPageViewMode(PDFViewCtrl.PageViewMode mode)
Sets the page viewing mode.
| ||||||||||
void | setPageViewMode(PDFViewCtrl.PageViewMode mode, int x, int y, boolean animate) | ||||||||||
void |
setPathHinting(boolean path_hinting)
Enable or disable path hinting.
| ||||||||||
void |
setPreferredViewMode(PDFViewCtrl.PageViewMode viewMode)
Sets the preferred view mode when maintain zoom level is enabled.
| ||||||||||
void |
setProgressiveRendering(boolean progressive)
Enables or disables progressive rendering.
| ||||||||||
void |
setProgressiveRendering(boolean progressive, int delay_ms, int interval_ms)
Enables or disables progressive rendering and sets the initial delay and
interval in milliseconds.
| ||||||||||
void |
setQuickScaleEnabled(boolean enabled)
Sets if PdfViewCtrl can dispatch quick scale event
| ||||||||||
void |
setRelativeZoomLimits(PDFViewCtrl.PageViewMode refViewMode, double min_zoom, double max_zoom)
Sets the minimum and maximum zoom bounds of PDFViewCtrl relative to ref_view_mode
Note: See note at | ||||||||||
void |
setRenderedContentCacheSize(long allowed_max)
Sets the suggested memory size of the rendered content.
| ||||||||||
void |
setRenderingListener(PDFViewCtrl.RenderingListener listener)
Sets the rendering listener.
| ||||||||||
void |
setRequiredFieldBorderColor(ColorPt cp)
Set the border color for required fields
This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`. | ||||||||||
void |
setRightToLeftLanguage(boolean flag)
Tells PDFViewCtrl the content in the viewed PDF document reads from right
to left.
| ||||||||||
void |
setSignatureHighlightColor(ColorPt cp)
Set the highlight color for signature fields
This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`. | ||||||||||
void |
setSnappingMode(int mode_flags)
Set the point snapping mode for the SnapToNearestInDoc method.
| ||||||||||
void |
setStylusScaleEnabled(boolean stylusScaleEnabled)
Set whether stylus should zoom when the primary stylus button is held.
| ||||||||||
void |
setTextSearchListener(PDFViewCtrl.TextSearchListener listener)
This method is deprecated.
use
addTextSearchListener(TextSearchListener) instead
Sets the text search listener.
| ||||||||||
void |
setTextSelectionMode(PDFViewCtrl.TextSelectionMode mode)
Sets the selection mode used for text highlighting.
| ||||||||||
void |
setThinLineAdjustment(boolean pixel_grid_fit, boolean stroke_adjust)
Sets thin line adjustment parameters.
| ||||||||||
void |
setToolManager(PDFViewCtrl.ToolManager mgr)
Sets the
PDFViewCtrl.ToolManager instance used by PDFViewCtrl. | ||||||||||
void |
setUniversalDocumentProgressIndicatorListener(PDFViewCtrl.UniversalDocumentProgressIndicatorListener listener)
Sets the Universal Document progress listener
| ||||||||||
void |
setUrlExtraction(boolean enabled)
Enables or disables URL extraction.
| ||||||||||
void |
setVScrollPos(int pos)
Sets the vertical scroll position.
| ||||||||||
void |
setVerticalAlign(int align)
Sets the vertical alignment used for rendering pages within the view.
| ||||||||||
static void |
setViewerCache(SDFDoc document, int max_cache_size, boolean on_disk)
Sets the cache parameters of the page cache on disk (which caches content
streams and mipmapped images) for this specific document.
| ||||||||||
boolean |
setZoom(double zoom)
Sets the zoom factor and re-render.
| ||||||||||
boolean |
setZoom(double zoom, boolean use_snapshot)
Sets the zoom factor and re-render.
| ||||||||||
boolean |
setZoom(int x, int y, double zoom)
Sets the zoom factor and re-render using the given coordinate (x,y) as a
zoom center.
| ||||||||||
boolean |
setZoom(int x, int y, double zoom, boolean use_snapshot)
Sets the zoom factor and re-render using the given coordinate (x,y) as a
zoom center.
| ||||||||||
boolean | setZoom(int x, int y, double zoom, boolean use_snapshot, boolean animate) | ||||||||||
void | setZoomEnabled(boolean enable) | ||||||||||
void |
setZoomLimits(PDFViewCtrl.ZoomLimitMode zoomLimitMode, double min_zoom, double max_zoom)
Sets the minimum and maximum zoom bounds of PDFViewCtrl.
| ||||||||||
void | setZoomingInAddingAnnotationEnabled(boolean enabled) | ||||||||||
void |
setupThumbnails(boolean use_embedded, boolean generate_at_runtime, boolean use_disk_cache, int thumb_max_side_length, long max_abs_cache_size, double max_perc_cache_size)
Specify the different thumbnail settings for the viewer.
| ||||||||||
void |
showAnnotation(Annot annot)
Enable rendering of a particular annotation.
| ||||||||||
boolean |
showRect(int page_num, Rect rect)
Adjusts the viewing area to fit a rectangle on a specified page.
| ||||||||||
boolean | smartZoom(int x, int y, boolean animate) | ||||||||||
boolean |
smartZoom(int x, int y)
Sets the zoom factor to a new value using the given pixel coordinate
(x,y) to find an intersecting paragraph.
| ||||||||||
PointF |
snapToNearestInDoc(double x, double y)
Returns the point within the document geometry that is closest to another
arbitrary point in screen space
| ||||||||||
String |
takeUndoSnapshot(String meta_info)
Creates a new state at the top of the undo/redo chain by taking a snapshot.
| ||||||||||
boolean |
turnPageInNonContinuousMode(int currentPage, boolean nextPage)
Turn to next or previous page in non-continuous mode when at the edge if possible
| ||||||||||
String |
undo()
Return to the previous state in the undo/redo chain.
| ||||||||||
void |
update(Annot annot, int page_num)
Redraws the area covered with a given annotation.
| ||||||||||
void |
update(boolean all)
Redraws the contents.
| ||||||||||
void |
update(Rect rec)
Redraws the given area in the client space.
| ||||||||||
void |
update(Field field)
Redraws all instances (Widgets) of the field.
| ||||||||||
void |
update()
Redraws the contents of the visible region.
| ||||||||||
void |
updateOCGContext()
This method is deprecated.
Updated the current Optional Content Group (OCG) context associated
with this PDFViewCtrl. This call might be helpful after, for example,
a stamp has been added to the document.
| ||||||||||
void |
updatePageLayout()
Updates the page layout within the view.
| ||||||||||
void |
waitForRendering(int milliseconds)
Waits about specified milliseconds or until the visible region is done
rendering, whichever is less.
| ||||||||||
void |
waitForRendering()
Waits about 1500 milliseconds or until the visible region is done
rendering, whichever is less.
| ||||||||||
boolean |
wereAnnotsForMousePrepared(int pageNum)
Checks if annotations of the given page have been prepared.
| ||||||||||
boolean |
wereWordsPrepared(int pageNum)
Checks if words of the given page have been prepared.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.ViewGroup
| |||||||||||
From class
android.view.View
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.graphics.drawable.Drawable.Callback
| |||||||||||
From interface
android.view.KeyEvent.Callback
| |||||||||||
From interface
android.view.ViewManager
| |||||||||||
From interface
android.view.ViewParent
| |||||||||||
From interface
android.view.accessibility.AccessibilityEventSource
|
Constructor that is called when inflating a view from XML. This is called when a view is being constructed from an XML file, supplying attributes that were specified in the XML file. This version uses a default style of 0, so the only attribute values applied are those in the Context's Theme and the given AttributeSet.
context | The Context the view is running in, through which it can access the current theme, resources, etc. |
---|---|
attrs | The attributes of the XML tag that is inflating the view. |
Perform inflation from XML and apply a class-specific base style. This constructor of View allows subclasses to use their own base style when they are inflating. For example, a Button class's constructor would call this version of the super class constructor and supply R.attr.buttonStyle for defStyle; this allows the theme's button style to modify all of the base view attributes (in particular its background) as well as the Button class's attributes.
context | The Context the view is running in, through which it can access the current theme, resources, etc. |
---|---|
attrs | The attributes of the XML tag that is inflating the view. |
defStyle | The default style to apply to this view. If 0, no style will be applied (beyond what is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource. |
Adds the document download listener.
Adds the document load listener.
Add a listener that will be called when the canvas size of the view change due to layout processing.
listener | The listener that will be called when layout bounds change. |
---|
Add the page change listener
Adds the text search listener.
Adds a listener to get events from getThumbAsync(int)
.
Adds the document conversion listener
Checks if can set the current page to the next page.
Checks if can set the current page to the previous page.
Returns true if redo operation is available.
PDFNetException | PDFNet exception |
---|
Returns true if undo operation is available.
PDFNetException | PDFNet exception |
---|
Cancels all thumbnail requests initiated by getThumbAsync(int)
.
PDFNetException |
---|
Cancels the current text search thread, if exists. Note that this
function does not block the current thread (the cancel notification
can be caught using the PDFViewCtrl.TextSearchListener
.
Cancels the rendering thread, if running.
Clear the thumbnail cache. See setupThumbnails(boolean, boolean, boolean, int, long, double)
.
PDFNetException |
---|
Closes the current document.
Note: This method will try to acquire a write lock internally. This way,
make sure you are not holding any read locks on the document, otherwise an exception
will be thrown. See docLock(boolean)
and docLockRead()
for more
info.
PDFNetException |
---|
Closes the current tool. This causes the tool's onClose() function to be called. A tool implementation should take this opportunity to stop any ongoing thread and clean up resources.
The overloaded implementation of View.computeScroll()
.
Converts a point in canvas space to the specified page space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
page_num | the page number for the page used as the origin of the destination coordinate system. Pages are indexed starting from one. |
Converts a point in canvas space to the current page space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
Converts a point expressed in canvas space to a point in screen space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
pageNumber | The page number whose canvas to use (only applies in non continuous modes). Default is current page. |
Converts a point expressed in canvas space to a point in screen space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
Converts a point in the specified page space to canvas space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
page_num | the page number for the page used as the origin of the destination coordinate system. Pages are indexed starting from one. |
Converts a point in the current page space to canvas space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
Converts a point from a page space to horizontal scrollable region space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
page_num | the page number for the page used as the origin of the destination coordinate system. Pages are indexed starting from one. |
Converts a point from a page space to horizontal scrollable region space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
page_num | the page number for the page used as the origin of the destination coordinate system. Pages are indexed starting from one. |
Converts a point from a page space to a point in screen space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
page_num | the page number for the page used as the origin of the destination coordinate system. Pages are indexed starting from one. |
Converts a point expressed in screen space to a point in (PDF) canvas space.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
pageNumber | The page number whose canvas to use (only applies in non continuous modes). Default is current page. |
Converts a point expressed in screen space to a point in (PDF) canvas space.
When converting points, PDFViewCtrl may refer to the following spaces:
For example, if you want to know the coordinates of the upper-left corner of the Canvas Space in the Screen space, you can simply use convCanvasPtToScreenPt(0,0). If you want to calculate the coordinates of the lower-left corner of page 1 in the Screen Space, you can use convPagePtToScreenPt(0, 0, 1). Or if you just want to know the coordinates of the upper left corner of the Screen Space in View Canvas Space, it is simply (getScrollX(), getScrollY()).
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
Converts a point expressed in screen space to a point on a page space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
page_num | the page number for the page used as the origin of the destination coordinate system. Pages are indexed starting from one. |
Converts a point expressed in screen space to a point on a page space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
Should be called in android.app.Activity.onDestroy() to destroy PDFViewCtrl and clean up memory and used resources.
Locks the PDFDoc instance used by PDFViewCtrl.
Simultaneous access to a PDFDoc instance is not allowed. Since
PDFViewCtrl renders a PDFDoc in a rendering thread, UI access to the same
PDFDoc instance should lock the document first and then unlock
docUnlock()
it afterwards. Threads attempting to access the
document will wait in suspended state until the thread that owns the lock
calls docUnlock()
.
cancel_rendering | If true, rendering thread is canceled first before trying to
lock the document. This ensures a quick return from this
function. Otherwise, this function can halt the UI and the app
may be unresponsive before the rendering thread finishes. If
the rendering thread is canceled, unlocking the document
docUnlock() will restart the rendering thread. |
---|
PDFNetException | PDFNet exception |
---|
Synchronously runs the code block defined in the Runnable while holding a write lock on the PDFDoc instance used by PDFViewCtrl. Will unlock when the code block is completed. Avoid running asynchronous operations in the code block as a write lock is no longer held for such operations
Simultaneous access to a PDFDoc instance is not allowed. Since
PDFViewCtrl renders a PDFDoc in a rendering thread, UI access to the same
PDFDoc instance should lock the document first and then unlock
docUnlock()
it afterwards. Threads attempting to access the
document will wait in suspended state until the thread that owns the lock
calls docUnlock()
.
cancel_rendering | If true, rendering thread is canceled first before trying to
lock the document. This ensures a quick return from this
function. Otherwise, this function can halt the UI and the app
may be unresponsive before the rendering thread finishes. If
the rendering thread is canceled, unlocking the document
docUnlock() will restart the rendering thread. |
---|---|
runnable | containing the code to run with write lock |
Exception | propagated exception from the LockRunnable or from locking |
---|
Synchronously runs the code block defined in the Runnable while holding a read lock on the PDFDoc instance used by PDFViewCtrl. Will unlock when the code block is completed. Avoid running asynchronous operations in the code block as a read lock is no longer held for such operations.
Locks the currently open document to prevent competing write threads
(using docLock(boolean)
) from accessing the document at the same time. Other reader
threads however, will be allowed to access the document. Threads attempting to obtain write
access to the document will wait in suspended state until the thread that owns the lock
calls docUnlockRead()
.
Note: To avoid deadlocks obtaining a write lock while holding a read lock is not permitted and will throw an exception. If this situation is encountered please either unlock the read lock before the write lock is obtained or acquire a write lock (rather than read lock) in the first place.
runnable | containing the code to run with write lock |
---|
Exception | propagated exception from the LockRunnable or from locking |
---|
Locks the PDFDoc instance used by PDFViewCtrl for reading.
Locks the currently open document to prevent competing write threads
(using docLock(boolean)
) from accessing the document at the same time. Other reader
threads however, will be allowed to access the document. Threads attempting to obtain write
access to the document will wait in suspended state until the thread that owns the lock
calls docUnlockRead()
.
Note: To avoid deadlocks obtaining a write lock while holding a read lock is not permitted and will throw an exception. If this situation is encountered please either unlock the read lock before the write lock is obtained or acquire a write lock (rather than read lock) in the first place.
PDFNetException | PDFNet exception |
---|
Try acquiring a write lock on the currently open document, waiting no longer than specified number of milliseconds.
PDFNetException | PDFNet exception |
---|
Try acquiring a read lock on the current document, waiting no longer than specified number of milliseconds.
PDFNetException | PDFNet exception |
---|
Unlocks the PDFDoc instance used by PDFViewCtrl and restarts the
rendering thread if it was canceled by calling docLock(boolean)
.
Removes the read lock from the PDFDoc instance used by PDFViewCtrl.
Enable separate rendering layer for annotations. Once enabled, can no longer disable in the same session.
PDFNetException |
---|
Enable Undo/Redo in this PDFview.
Note: Undo/Redo works only if the document is saved incrementally
(refer to save(Filter, long)
for example)
PDFNetException | PDFNet exception |
---|
Executes the action.
PDFNetException |
---|
Searches asynchronously, starting from the current page, for the given
text. PDFViewCtrl automatically scrolls to the position so that the found
text is visible. Note that users can retrieve the geometric information
of the found text from PDFViewCtrl.Selection
for highlighting in PDFViewCtrl
and other purposes.
Since the search is done asynchronously, the user must use the
TextSearchListener to listen for search events. Even if the listener is
null
, upon completion PDFViewCtrl will still scroll to the
position where the text was found. The listener can be set using
setTextSearchListener(TextSearchListener)
.
Calling this function again will automatically cancels any ongoing text search thread and searches from the previous location. This method also automatically wraps around the document.
Note: This method should be called in UI thread.
search_str | the text to search for |
---|---|
match_case | indicates if it is case sensitive |
match_whole_word | indicates if it matches an entire word only |
search_up | indicates if it searches upward |
reg_exp | indicates if it uses regular expressions. For more details about the regular expression syntax, please refer to Regular Expression Syntax. |
page_num | indicates the page to start searching on |
Searches asynchronously, starting from the current page, for the given
text. PDFViewCtrl automatically scrolls to the position so that the found
text is visible. Note that users can retrieve the geometric information
of the found text from PDFViewCtrl.Selection
for highlighting in PDFViewCtrl
and other purposes.
Since the search is done asynchronously, the user must use the
TextSearchListener to listen for search events. Even if the listener is
null
, upon completion PDFViewCtrl will still scroll to the
position where the text was found. The listener can be set using
setTextSearchListener(TextSearchListener)
.
Calling this function again will automatically cancels any ongoing text search thread and searches from the previous location. This method also automatically wraps around the document.
Note: This method should be called in UI thread.
search_str | the text to search for |
---|---|
match_case | indicates if it is case sensitive |
match_whole_word | indicates if it matches an entire word only |
search_up | indicates if it searches upward |
reg_exp | indicates if it uses regular expressions. For more details about the regular expression syntax, please refer to Regular Expression Syntax. |
Forces the PDFViewCtrl to immediately stop the flinging action.
Returns the size of the scrollable spaces for all canvases. for N canvases, returns a vector of 3*N numbers in the form [canvas_id_1, width_1, height_1 ... canvas_id_N, width_N, height_N]
Gets annotation type at the given point
x | x coordinate of the input point |
---|---|
y | y coordinate in the input point |
Gets the annotation at the (x, y) position expressed in screen coordinates.
Note: For details about screen space, please refer to
convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
Gets the annotation at the (x, y) position expressed in screen coordinates.
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
distanceThreshold | Maximum distance from the point (x, y) to the annotation for the annot to be considered a hit (in dp). |
minimumLineWeight | For very thin lines, it is almost impossible to hit the actual line. This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating whether a point is inside the annotation or not (in dp). |
Gets the list of annotations at line (x1, y1, x2, y2) expressed in screen coordinates
x1 | x coordinate of the screen point at one of the end points of the line |
---|---|
y1 | y coordinate of the screen point at one of the end points of the line |
x2 | x coordinate of the screen point at another end point of the line |
y2 | y coordinate of the screen point at another end point of the line |
Gets the list of annotations on a given page.
page_num | The page number, where 1 is the first page. |
---|
Returns the height of Zoomed PDF Canvas Space. For more details, please
refer to the documentation of
convScreenPtToCanvasPt(double, double)
.
Returns the width of Zoomed PDF Canvas Space. For more details, please
refer to the documentation of
convScreenPtToCanvasPt(double, double)
.
Gets the background color of the client area.
Gets the size of the actual content in the current canvas meaning all pages, as well as gaps and padding set by setPageSpacing
size | - returns with at index 0 and height at index 1 |
---|
Gets the current page number.
Note: Page number starts from 1.
Gets the device transformation matrix.
page_num | the page number for the page used as the origin of the destination coordinate system. Pages are indexed starting from one. |
---|
Gets the device transformation matrix.
Note: To obtain a transformation matrix that maps screen coordinates to page coordinates, you can invert the device matrix. For example:
Matrix2D scr2page(pdfView.getDeviceTransform());
scr2page.inverse();
Gets the bottom display cutout height
Gets the top display cutout height
Gets the external annot manager belonging to this PDFViewCtrl
PDFNetException | PDFNet Exception |
---|---|
NullPointerException |
Gets the current horizontal scroll position. The returned value is expressed in the canvas coordinate system.
Note: This call is the same as View.getScrollX() if maintain zoom feature is disabled, otherwise, is the scroll offset within the current canvas
Gets the link info at a given point, specified in screen space.
Note: To get valid links, setUrlExtraction(boolean)
must be
set to true before opening the document.
x | the x position in screen space |
---|---|
y | the y position in screen space |
PDFViewCtrl.LinkInfo
object with the link information or null if
no link is found in the queried location.
PDFNetException |
---|
Gets if PdfViewCtrl can read long press event
Returns any meta-data associated with the next sate in the undo/redo chain.
PDFNetException | PDFNet exception |
---|
Returns any meta-data associated with the previous sate in the undo/redo chain.
PDFNetException | PDFNet exception |
---|
Gets the OCG context.
null
if there is no OCG context
associated with the view. If there is an OCG context associated
with the view, optional content (such as PDF layers) will be
selectively rendered based on the states of optional content
groups in the given context.PDFNetException | PDFNet exception |
---|
Gets the box used by PDFViewCtrl for rasterizing.
setPageBox(int)
for more information on the return values.
PDFNetException |
---|
Gets the page count.
NOTE: call PDFDoc.getPageCount() instead if any document pages are changed and updatePageLayout has not yet been called
Gets the number of the page on which the specified point in screen space.
Note: For space details, please refer to convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the input point |
---|---|
y | y coordinate of the input point |
Gets the current page presentation mode.
setPagePresentationMode(PagePresentationMode)
for more information on the return values.
Gets the annotation bounding box in page coordinates
annot | target annotation |
---|---|
page_num | the page number where the annotation is on |
PDFNetException |
---|
Gets the reference page view mode. See more details about reference
page view mode in setPageRefViewMode(PageViewMode)
.
Gets the current rotation applied to all pages in PDFViewCtrl.
Gets the extra transformation matrix applied to the android.graphics.Canvas object used by PDFViewCtrl during page sliding.
Note: This matrix is normally identity except that when the built-in page sliding is in process. If it is desirable to draw contents that do not move during the sliding process, the inverse of this matrix can be temporarily applied to the Canvas to offset its effect.
Gets the current page viewing mode.
setPageViewMode(PageViewMode)
for more information on the return values.
Convert a color based on the defined post processing transformation in
setColorPostProcessMapFile(Filter)
.
cp | the color to be converted |
---|
Gets the preferred view mode when maintain zoom level is enabled
Checks if progressive rendering is used.
Gets if PdfViewCtrl can dispatch quick scale event
Checks if PDFViewCtrl thinks the content in the viewed PDF document reads from right to left.
Gets the annotation bounding box in screen coordinates
annot | target annotation |
---|---|
page_num | the page number where the annotation is on |
PDFNetException |
---|
Gets the text PDFViewCtrl.Selection
on a given page.
page | the number of the given page |
---|
Returns the first page number that has text PDFViewCtrl.Selection
on it.
Useful when there are selections on multiple pages at the same time.
Returns the last page number that has text PDFViewCtrl.Selection
on it.
Useful when there are selections on multiple pages at the same time.
This will request a thumbnail for the given page number.
When the thumbnail is ready, the onThumbReceived(int, int[], int, int)
event will be raised with the finished thumbnail. If multiple requests are made, the
thumbnail requests will be processed starting with the last request. The exception is that
the current thumbnail being rendered will always finish.
It is recommended to cancel all thumbnail requests once they are not needed any more, using
cancelAllThumbRequests()
.
If caching is enabled, this request will be much faster once the thumb has been rendered
once. You can enable caching by using setViewerCache(com.pdftron.sdf.SDFDoc, int, boolean)
and setDefaultDiskCachingEnabled(boolean)
.
page_num | the page which we want to receive a thumbnail for |
---|
PDFNetException |
---|
Gets the PDFViewCtrl.ToolManager
instance used by PDFViewCtrl. By default, there is no
tool manager used by PDFViewCtrl.
Gets the current vertical scroll position. The returned value is expressed in the canvas coordinate system.
Note: This call is the same as View.getScrollY() if maintain zoom feature is disabled, otherwise, is the scroll offset within the current canvas
Returns the height of PDFViewCtrl Canvas space. For more details, please
refer to the documentation of
convScreenPtToCanvasPt(double, double)
.
Returns the width of PDFViewCtrl Canvas space. For more details, please
refer to the documentation of
convScreenPtToCanvasPt(double, double)
.
Gets an array with the pages currently visible on the screen.
Gets an array with the pages currently visible on the screen. While in horizontal page sliding mode, this method will also return the adjacent pages.
Gets the current zoom factor.
Calculates the zoom for the current view if it was currently in the view mode set by
setPageViewMode(PageViewMode)
with viewMode
viewMode | The reference page view mode to set. |
---|
setPageViewMode(PageViewMode)
was set with viewModePDFNetException | PDFNet exception |
---|
Sets the current page to the first page.
Sets the current page to the last page.
Sets the current page to the next page.
Sets the current page to the previous page.
Checks if there is any text PDFViewCtrl.Selection
.
Checks if there is any text PDFViewCtrl.Selection
on a given page.
page | the page number of the given page |
---|
Disable rendering of a particular annotation. This does not change the annotation itself, just how it is displayed in this viewer instance.
annot | The annotation object to cease drawing for. |
---|
Utility function that checks if the page presentation mode is continuous.
Utility function that checks if the page presentation mode is facing.
Checks if the rendering thread finishes or the current visible region has been fully rendered.
Note: Since PDFViewCtrl might pre-render invisible regions, the rendering thread might still be ongoing even if the current visible region has been rendered. If visible_region_only parameter is set to true, this function only checks if the visible region has been rendered, regardless if the rendering thread is ongoing.
Checks if the rendering thread has finished.
Checks if PDFViewCtrl is hardware accelerated.
Gets whether the viewer is currently in horizontal page transition mode while the current canvas is zoomed in before the sliding happens
Get whether stylus should zoom when the primary stylus button is held.
Checks if in the given region there is any text. Point (x1, y1) is the start selection point and point (x2, y2) is the end selection point. The points are defined in screen space.
Checks if PDFViewCtrl is valid.
Changes the viewing area to fit an annotation. This will adjust current page and scroll position appropriately.
annot | the annotation |
---|---|
pageNum | the page number |
PDFNetException |
---|
annotId | the annotation id to jump to |
---|
Call this method to trigger the Tools' onConfigurationChanged event.
newConfig | the new device configuration |
---|
The overloaded implementation of View.onGenericMotionEvent(MotionEvent)
.
Notified when a key was released.
keyCode | A key code that represents the button pressed, from android.view.KeyEvent. |
---|---|
event | The KeyEvent object that defines the button action. |
true
to prevent this event from being propagated
further, or false
to indicate that you have not handled
this event and it should continue to be propagated.
The overloaded implementation of android.view.onTouchEvent().
Utility function for opening a non-PDF document for display.
fileFilter | file filter from content uri |
---|---|
options | conversion options |
DocumentConversion
object if successful, null otherwise
PDFNetException |
---|
Utility function for opening a non-PDF document for display.
fileUri | the file uri, can be a content uri, or a storage file uri |
---|---|
options | conversion options |
DocumentConversion
object if successful, null otherwise
FileNotFoundException | |
---|---|
PDFNetException |
Utility function for opening a PDF document for display.
fileFilter | file filter from content uri |
---|
PDFNetException |
---|
Utility function for opening a PDF document for display.
fileUri | the file uri, can be a content uri, a storage file uri or HTTP/HTTPS link |
---|---|
password | the file password |
cachePath | the cache location if file is opened with HTTP/HTTPS link |
httpRequestOptions | the PDFViewCtrl.HTTPRequestOptions if file is opened with HTTP/HTTPS link |
PDFNetException | PDFNet exception |
---|---|
FileNotFoundException | File not found exception |
Utility function for opening a PDF document for display.
Use openPDFUri(Uri, String, String, HTTPRequestOptions)
if you need to cache file
opened with HTTP/HTTPS link
fileUri | the file uri, can be a content uri, a storage file uri or HTTP/HTTPS link |
---|---|
password | the file password |
PDFNetException | PDFNet exception |
---|---|
FileNotFoundException | File not found exception |
Sets the PDF document to be displayed.
Note: This method acquires a write lock on the current document, so the document must be unlocked when this method is called or an exception will be thrown.
PDFNetException |
---|
Sets the PDF document, from a URL, that is to be displayed. If successful, PDFViewCtrl will download the PDF document and display it. If the PDF file is linearized, PDFViewCtrl will download it incrementally while displaying it; otherwise, PDFViewCtrl will show blank pages until the entire document is downloaded.
Since this function starts the actual download work in a worker thread,
it returns quickly to avoid blocking UI.
addDocumentDownloadListener(DocumentDownloadListener)
can be
used to listen to the download result, e.g., FAILED
.
Note:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
onDocumentDownloadEvent(DownloadState, int, int, int, String)
or
PDFViewCtrl.DocumentDownloadListener
.
url | the URL of the document to open. It supports HTTP and HTTPS. |
---|---|
cachePdf | This function will use downloaded data to construct a PDF in this location.
If null or blank, the PDF will be stored in a temporary location.
If the path points to the result of a previous call to this function
for this particular URL, then PDFViewCtrl will resume that download.
This should be a full (non-relative) path.
Note that if disk caching is disabled this file will not be used. |
password | the password used to open the document |
options | HTTP request options to use with every HTTP request, may be null |
PDFNetException |
---|
Should be called in android.app.Activity.onPause() to pause PDFViewCtrl.
Note: This method simply stops the current ongoing rendering thread, text search thread, and tool.
Posts a message to cause onCustomEvent(Object)
to be
called in the next main message loop. This is useful if a Tool needs to
be called by PDFViewCtrl in the main message loop without a touch event
being triggered.
obj | An Object that can be passed back in onCustomEvent(Object)
function.
|
---|
Requests for preparing annotations of the given page.
Note: Annotations are going to be prepared asynchronously
pageNum | page number |
---|---|
distanceThreshold | Maximum distance from the point (x, y) to the annotation for the annot to be considered a hit (in dp).
see getAnnotationAt(int, int, double, double) |
minimumLineWeight | For very thin lines, it is almost impossible to hit the actual line.
This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating whether
a point is inside the annotation or not (in dp). see getAnnotationAt(int, int, double, double)
|
Requests for preparing annotations of the given page.
Note: Annotations are going to be prepared asynchronously
pageNum | page number |
---|
Requests for preparing words of the given page.
Note: Words are going to be prepared asynchronously
pageNum | page number |
---|
Call this method to lower PDFViewCtrl's memory consumption, such as in Activity.onLowMemory().
Note that onLowMemory() is called when a user is running too many applications and the OS needs to recover the memory from them. Exceeding your own application's VM heap quota does NOT cause onLowMemory() to be called. For this sake, it is a good practice in your code to catch OutOfMemoryError exception and then call this method.
it is a good practice in your code to catch OutOfMemoryError exception and then call this method.
Go to the next state in the undo/redo chain. Returns any meta-data associated with that state.
PDFNetException | PDFNet exception |
---|
Helper function that will refresh annotation and/or field appearances if needed, and then render modified page areas, all based on the contents of the view_change parameter.
view_change | contains all the updated fields and rectangles. |
---|
PDFNetException | PDFNet exception |
---|
Removes the document download listener.
Removes the document load listener.
Removes the canvas size change listener.
Remove Page change listener
listener | listener |
---|
Removes the text search listener.
Removes thumb async listener.
Removes the document conversion listener
Overloaded version of android.view.View.requestLayout(). Call this when something has changed which has invalidated the layout of this view. This will schedule a layout pass of the view tree.
Requests that PDFViewCtrl start rendering, if necessary.
Note: invalidate() simply causes the window to be repainted at the system
level. It does not make PDFViewCtrl to render anything new.
requestRendering() tells PDFViewCtrl to check if there are regions
(both visible and invisible) that have not been rendered; if so a
background rendering thread will be started. This function should
be called if cancelRendering()
was called to stop the ongoing
rendering thread. update()
tells PDFViewCtrl to discard
the rendered content and start a rendering thread. This function
should be used if the content of the PDF is modified.
Should be called in android.app.Activity.onResume() to resume PDFViewCtrl.
Note: This method simply starts the rendering thread to ensure the PDF content is available for viewing.
Returns to the initial state in the undo/redo chain
PDFNetException | PDFNet exception |
---|
Rotates all pages in the document 90 degrees clockwise.
Note: After calling this method you must also update the page layout.
See updatePageLayout()
for more information.
Rotates all pages in the document 90 degrees counter-clockwise.
Note: After calling this method you must also update the page layout.
See updatePageLayout()
for more information.
Overloaded implementation of android.view.View.scrollBy(). It moves the scroll position of PDFViewCtrl, if it is in a continuous page presentation mode.
dx | the amount of pixels to scroll by horizontally |
---|---|
dy | the amount of pixels to scroll by vertically |
Overloaded implementation of android.view.View.scrollTo(). It sets the scroll position of PDFViewCtrl, if it is in a continuous page presentation mode.
x | the x position to scroll to. |
---|---|
y | the y position to scroll to. |
Selects text within the given region using the current text selection mode. Point (x1, y1) is the start selection point and point (x2, y2) is the end selection point. The points are defined in screen space.
Selects text using structural mode. Point (x1, y1) is the start selection point on page 'page1' and point (x2, y2) is the end selection point on page 'page2'.
Selects all the text in the document.
Selects texts identified by Highlights. Also scroll to the Highlights if selected.
highlights | the Highlights to be selected |
---|
Selects text within the given region using rectangular selection mode. Point (x1, y1) is the start selection point and point (x2, y2) is the end selection point. The points are defined in screen space.
Selects text within the given region using structural text selection mode and with smart snapping. Point (x1, y1) is the start selection point and point (x2, y2) is the end selection point. The points are defined in screen space.
Note: The internal state of text selection having snapping information is cleared when calling #ClearSelection(long)
Selects text within the given region using the current text selection mode with defined snap-to-start and snap-to-end modes.
x1 | two points (screen coordinates, origin located at the upper-left corner of this view) |
---|---|
y1 | two points (screen coordinates, origin located at the upper-left corner of this view) |
x2 | two points (screen coordinates, origin located at the upper-left corner of this view) |
y2 | two points (screen coordinates, origin located at the upper-left corner of this view) defining the opposite corners of a selection rectangle. |
snap_to_start | if selected text should contain the whole word at start of selection points. |
snap_to_end | if selected text should contain the whole word at end of selection points. |
Selects texts identified by Highlights.
highlights | the Highlights to be selected |
---|
Selects texts identified by Selection.
sel | the Selection to be selected |
---|
Sets action completed listener.
Enables or disables anti-aliasing. Anti-aliasing is enabled by default.
PDFNetException |
---|
Sets the parameter of built-in page turning effect.
animationDuration | This parameter sets the total animation duration of a fling event. The default value is android.R.integer.config_longAnimTime. |
---|
Enables or disables the built-in page turning animation effect (sliding) when
it is under non-continuous page presentation mode (setPagePresentationMode(PagePresentationMode)
).
Page turning is triggered by fling and scroll events when the current page
reaches its boundary.
Sets the current state of page slider.
state | true if sliding functionality is on, false otherwise.
If page sliding is not enabled through setBuiltInPageSlidingEnabled(boolean) ,
this method will be no-op.
|
---|
Sets the parameter of built-in page turning effect.
fling_dp_per_second | This parameter sets the lowest speed of a fling event, in device independent pixel per second, that could trigger the built-in page turning effect. The default value is 1000. |
---|
Sets the parameter of zoom animation effect.
animationDuration | This parameter sets the total animation duration of a zoom event if animate is set to true.
See smartZoom(int, int, boolean) , setZoom(int, int, double, boolean, boolean)
and setPageViewMode(PageViewMode, int, int, boolean)
The default value is android.R.integer.config_shortAnimTime.
|
---|
Enables or disables caching. When caching is enabled, PDFViewCtrl may store certain PDF contents, e.g., images, fonts, in memory for fast repeated accessing. By default, caching is disabled.
PDFNetException |
---|
Sets the background color of the client area.
r | red component of the background color |
---|---|
g | green component of the background color |
b | blue component of the background color |
transparent | if true, the client region is transparent |
PDFNetException |
---|
Sets the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output.
This mode will map the brightness of the original rasterized bitmap to a gradient between whiteColor and blackColor
whiteColor | the white color of page |
---|---|
blackColor | the black color of page |
PDFNetException |
---|
Sets the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output.
This mode will map the brightness of the original rasterized bitmap to a gradient in image_file_contents from left to right
image_file_contents | is a filter with image file contents |
---|
PDFNetException |
---|
Sets the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output.
mode | is the specific transform to be applied |
---|
PDFNetException |
---|
Goes to the specified page.
page_num | specified page number |
---|
Sets the default 'paper' color used to draw background of each page.
c | the color |
---|
PDFNetException |
---|
Sets the default 'paper' color used to draw background of each page.
r | red component of the color |
---|---|
g | green component of the color |
b | blue component of the color |
PDFNetException |
---|
Sets device dpi
dpi | the device density |
---|---|
scale_factor | the scale factor |
Sets the display cutout
top | the top cutout height |
---|---|
bottom | the bottom cutout height |
Sets the PDF document to be displayed.
Note: This method acquires a write lock on the current document, so the document must be unlocked when this method is called or an exception will be thrown.
PDFNetException |
---|
Enables or disables annotation and forms rendering. By default, all annotations and form fields are rendered.
PDFNetException |
---|
Sets the error report listener.
Set the highlight color for fields
This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`. Note that signature fields have their own highlight color, independent of this one (see `setSignatureHighlightColor`).
cp | the new color, in rgba form. |
---|
PDFNetException |
---|
Sets the gamma factor used for anti-aliased rendering.
Gamma correction can be used to improve the quality of anti-aliased image output and can (to some extent) decrease the appearance common anti-aliasing artifacts (such as pixel width lines between polygons).
exp | is the exponent value of gamma function. Typical values are in the range from 0.1 to 3. |
---|
PDFNetException |
---|
Sets the horizontal scroll position. The position should be a number in
the range between 0 and getCanvasWidth()
. The 'pos' parameter
is expressed in the canvas coordinate system.
Note: This call is the same as View.setScrollX().
pos | the new horizontal scroll position |
---|
Enable or disable highlighting form fields. Default is disabled.
highlight_fields | true to highlight, false otherwise. |
---|
PDFNetException |
---|
Sets the horizontal alignment used for rendering pages within the view.
align | an integer specifying the horizontal alignment. Depending of
whether align is positive, negative, or zero, pages will be
right, left or center aligned:
|
---|
PDFNetException |
---|
Sets if image smoothing is used. By default, image smoothing is disabled.
PDFNetException |
---|
Enable or disable user input for PDFViewCtrl.
Sets if PdfViewCtrl can dispatch long press event
enable | true to make PdfViewCtrl able to read long press event, false otherwise |
---|
Sets the minimum ref zoom used for calculating the maximum zoom limit when using relative zoom limits. That is, if the reference zoom limit is less than required_zoom, then required_zoom will be used for the purposes of setting the max zoom limit.
Note: See note at setZoomLimits(ZoomLimitMode, double, double)
for explanation of
relative zoom limits.
required_zoom | The minimum ref zoom |
---|
Adjusts the position of PDFViewCtrl content.
extra_scroll_x | Scroll by this amount in x direction after resizing of PDFViewCtrl |
---|---|
extra_scroll_y | Scroll by this amount in y direction after resizing of PDFViewCtrl |
animateZoomLimitsIfNecessary | Whether to animate if zoom limit is hit |
Sets the Optional Content Group (OCG) context that should be used when viewing the document. This function can be used to change the current OCG context. Optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context.
Note: Unlike setOCGContext(com.pdftron.pdf.ocg.Context)
, this method
copies the given context. As a result, in order to modify the state of OCG
groups in the curent context use getOCGContext()
to obtain the currently
selected content and then modify states.
ctx | Optional Content Group (OCG) context, or null if the
rasterizer should render all content on the page. |
---|
PDFNetException | PDFNet exception |
---|
Enables or disables support for overprint. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). By default overprint is disabled for efficient viewing.
overprint | the overprint mode. |
---|
PDFNetException |
---|
Enables or disables drawing of a thin border around each page.
borderVisibility | If true, the border will be visible. |
---|
PDFNetException |
---|
Selects the PageBox to rasterize. PDFViewCtrl will clip pages according to their PageBox as selected here.
region | the region to be used for clipping. Possible values are: |
---|
PDFNetException |
---|
Sets the page presentation mode.
mode | the new page presentation mode. |
---|
Sets the reference page view mode. In a non-continuous page presentation
mode, the reference page view mode is used to determine the page view
mode upon a page change event. For example, if the reference page view
mode is set to FIT_WIDTH
, the new page coming in will
be displayed with width-fit mode. Default value is FIT_PAGE
.
mode | The reference page view mode to set. |
---|
PDFNetException |
---|
Sets the padding for PDFViewCtrl, as well as vertical and horizontal padding and column spacing between adjacent pages in the view.
horiz_col_space | horizontal column spacing (represented in pixels) between adjacent pages in the view. Default is 3. |
---|---|
vert_col_space | vertical column spacing (represented in pixels) between adjacent pages in the view. Default is 3. |
horiz_pad | horizontal padding (represented in pixels) on the left and right side of the view. Default is 0. |
vert_pad | vertical padding (represented in pixels) on the top and bottom side of the view. Default is 0. |
Sets the vertical and horizontal padding and column spacing between adjacent pages in the view.
horiz_col_space | horizontal column spacing (represented in DP) between adjacent pages in the view. Default is 3 pixels. |
---|---|
vert_col_space | vertical column spacing (represented in DP) between adjacent pages in the view. Default is 3 pixels. |
horiz_pad | horizontal padding (represented in DP) on the left and right side of the view. Default is 0 pixels. |
vert_pad | vertical padding (represented in DP) on the top and bottom side of the view. Default is 0 pixels. |
Enables or disables the transparency grid (check board pattern) to reflect page transparency.
trans_grid_visible | if true, the grid is turned on. |
---|
PDFNetException |
---|
Sets the page viewing mode. The page viewing mode takes effect when it is set, open a new document, or double click.
Note: If you call setPageViewMode(newMode) and the current mode is different than newMode, the control will trigger a request layout and you might see a flickering.
mode | the new page viewing mode. |
---|
Enable or disable path hinting.
path_hinting | if true path hinting is enabled. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements. This option is turned on by default. |
---|
PDFNetException |
---|
Sets the preferred view mode when maintain zoom level is enabled.
Enables or disables progressive rendering. By default, progressive rendering is enabled.
progressive | If true, progressive rendering is enabled; otherwise, it is disabled. |
---|
Enables or disables progressive rendering and sets the initial delay and interval in milliseconds. By default, progressive rendering is enabled, initial delay is 2000 ms and interval is 750 ms.
progressive | If true, progressive rendering is enabled; otherwise, it is disabled. |
---|---|
delay_ms | The initial delay in milliseconds of starting progressive rendering. This might be desirable due to the use of thumb nail views. Only effective if progressive is true. |
interval_ms | The interval in milliseconds between two consecutive progressive updates. Only effective if progressive is true. |
Sets if PdfViewCtrl can dispatch quick scale event
enabled | true to make PdfViewCtrl able to read quick scale event, false otherwise |
---|
Sets the minimum and maximum zoom bounds of PDFViewCtrl relative to ref_view_mode
Note: See note at setZoomLimits(ZoomLimitMode, double, double)
for explanation of
relative zoom limits.
refViewMode | The reference page view mode to set. |
---|---|
min_zoom | the minimum zoom bound |
max_zoom | the maximum zoom bound |
PDFNetException |
---|
Sets the suggested memory size of the rendered content.
PDFViewCtrl keeps invisible content in order to achieve smoother viewing experience; however, this increases memory usage. Android sets an upper bound on the VM heap size allowed for an app. By default, PDFViewCtrl is set to use a quarter of that amount for keeping visible and invisible content. Based on the memory footprint of your app, you may want to customize it.
The following code shows a sample usage of this function:
long allowed_max = Runtime.getRuntime().maxMemory() / (1024 * 1024);
setRenderedContentCacheSize((long) (allowed_max * 0.25)); //should NOT use close to allowed_max
Note: If you want to minimize the heap memory usage at the cost of viewing experience quality, you can set allowed_max to 0 and PDFViewCtrl will not keep any invisible content. Also note that this function only controls the memory usage of VM heap size by PDFViewCtrl, but not the native memory that PDFViewCtrl might use.
On Android 3.0 and above, you can increase the allowed heap size of
an app by setting android:largeHeap="true"
in the app's manifest
file.
allowed_max | the allowed heap memory usage in MB |
---|
PDFNetException |
---|
Sets the rendering listener.
Set the border color for required fields
This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`.
cp | the new color, in rgba form. |
---|
PDFNetException |
---|
Tells PDFViewCtrl the content in the viewed PDF document reads from right to left.
PDFNetException |
---|
Set the highlight color for signature fields
This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`. Note that non-signature fields have their own highlight color, independent of this one (see `setFieldHighlightColor`)
cp | the new color, in rgba form. |
---|
PDFNetException |
---|
Set the point snapping mode for the SnapToNearestInDoc method. By default SnapToNearestInDoc will snap to line endpoints, midpoints, and intersections.
mode_flags | a bitwise combination of the members of `GeometryCollection.SnappingMode` |
---|
Set whether stylus should zoom when the primary stylus button is held.
This method is deprecated.
use addTextSearchListener(TextSearchListener)
instead
Sets the text search listener.
Sets the selection mode used for text highlighting.
mode | the text selection mode. |
---|
Sets thin line adjustment parameters.
pixel_grid_fit | If true (horizontal/vertical) thin lines will be snapped to integer pixel positions. This helps make thin lines look sharper and clearer. This option is turned off by default and it only works if path hinting is enabled. |
---|---|
stroke_adjust | If true auto stroke adjustment is enabled. Currently, this would make lines with sub-pixel width to be one-pixel wide. This option is turned on by default. |
PDFNetException |
---|
Sets the PDFViewCtrl.ToolManager
instance used by PDFViewCtrl. By default, there is no
tool manager used by PDFViewCtrl.
Sets the Universal Document progress listener
Enables or disables URL extraction. By default URL extraction is disabled.
Note: If set to enabled when the document is already opened, it may not find links on pages that were already rendered. It is suggested to set this flag before opening the document.
enabled | if true, URL extraction is enabled; false otherwise. |
---|
PDFNetException |
---|
Sets the vertical scroll position. The position should be a number in
the range between 0 and getCanvasHeight()
. The 'pos' parameter
is expressed in the canvas coordinate system.
Note: This call is the same as View.setScrollY().
pos | the new vertical scroll position |
---|
Sets the vertical alignment used for rendering pages within the view.
align | an integer specifying the vertical alignment. Depending of
whether align is positive, negative, or zero, pages will be
bottom, top or center aligned:
|
---|
PDFNetException |
---|
Sets the cache parameters of the page cache on disk (which caches content streams and mipmapped images) for this specific document. These parameters will override the default cache parameters set by PDFNet.setViewerCache(). Note that if this function is called after the document has been rasterized, it has no effect.
Note: Setting max_cache_size to zero will disable the cache. Also, once this
cache is used, setCaching(boolean)
will be ineffective.
max_cache_size | The maximum size, in bytes, of the entire document's page cache. The maximum cache size is 100 MB. |
---|---|
on_disk | Whether or not store the cache on disk. |
PDFNetException | PDFNet exception |
---|
Sets the zoom factor and re-render. This function zooms to the center of the screen region.
Note: This function is similar to setZoom(double, boolean)
, but
with the second parameter being false.
zoom | New zoom factor used to display the page content. |
---|
Sets the zoom factor and re-render. This function zooms to the center of the screen region.
zoom | New zoom factor used to display the page content. |
---|---|
use_snapshot | If true, PDFViewCtrl takes a snapshot of the current client area and shows it before the content after zooming is ready. |
Sets the zoom factor and re-render using the given coordinate (x,y) as a zoom center.
The zoom center (x,y) is represented in the screen space, whose origin is at the upper-left corner of the screen region.
Note: This function is similar to setZoom(int, int, double, boolean)
,
but with the last parameter being false.
x | The horizontal coordinate of the center in screen space. |
---|---|
y | The vertical coordinate of the center in screen space. |
zoom | New zoom factor used to display the page content. |
Sets the zoom factor and re-render using the given coordinate (x,y) as a zoom center.
The zoom center (x,y) is represented in the screen space, whose origin is at the upper-left corner of the screen region.
x | The horizontal coordinate of the center in screen space. |
---|---|
y | The vertical coordinate of the center in screen space. |
zoom | New zoom factor used to display the page content. |
use_snapshot | If true, PDFViewCtrl takes a snapshot of the current client area and shows it before the content after zooming is ready. |
Sets the minimum and maximum zoom bounds of PDFViewCtrl.
Note: If RELATIVE
is used,
min_zoom and max_zoom are relative to the zoom level when the
current page is displayed in the mode set by
setPageRefViewMode(PageViewMode)
. For
instance, if min_zoom = 1.0 and max_zoom = 3, it means that the
minimum zoom allowed by PDFViewCtrl is the same as the zoom when a
page is fit and the maximum zoom allowed is three times that when
the page is fit. PDFViewCtrl limits the minimum zoom bound to 0.01
and the maximum zoom bound to 500.0.
zoomLimitMode | Defines how the minimum and maximum zoom bounds are used. |
---|---|
min_zoom | the minimum zoom bound |
max_zoom | the maximum zoom bound |
PDFNetException |
---|
Specify the different thumbnail settings for the viewer.
Thumbnail view is used before a PDF page is fully rendered. If generate_at_runtime is enabled, PDFViewCtrl generates thumbnail views at runtime. If a PDF file already contains the thumbnail views, runtime thumb view generation can be turned off, which is more efficient.
If generate_at_runtime is enabled, the thumb_max_side_length will be used as a reference to calculate the thumbnail resolution.
Note: High values of thumb_max_side_length will require more heap memory from the VM, and this can lead to some 'out of memory exceptions' due to the nature of the core and how bitmaps are natively managed by Android. You may want to configure your application to use a larger heap in the manifest file if you need to push this setting to higher values.
use_embedded | Enables or disables using thumbnails embedded in the PDF document as a preview of the rendered page. Default is enabled. |
---|---|
generate_at_runtime | Enables or disables generating thumbnails at runtime. Default is enabled. |
use_disk_cache | Enables or disables caching thumbnails in a temporary disk file. Default is disabled. |
thumb_max_side_length | The maximum size, in pixels, of a dimension of generated thumbnails. Pass zero to use the default internal value. Default value is 0. |
max_abs_cache_size | The absolute maximum size on disk, in bytes, for the temporary thumbnail cache. Default value is 200 MB. |
max_perc_cache_size | The maximum percentage of free disk space, in the range 0 - 1.0, that the cache can take up. Default is 0.4 (40%). |
PDFNetException |
---|
Enable rendering of a particular annotation. Only has an effect if HideAnnotation() has previously been called on the same annot.
annot | The annotation object to resume rendering. |
---|
Adjusts the viewing area to fit a rectangle on a specified page. Rectangle must be specified in page space. This will adjust current page and zoom appropriately.
page_num | specified page number |
---|---|
rect | the rectangle to fit in |
PDFNetException |
---|
Sets the zoom factor to a new value using the given pixel coordinate (x,y) to find an intersecting paragraph.
The width of the paragraph helps to determine the zoom value, center of the paragraph is used as a zoom center. Paragraph has to contain more than one line and be wider than 1/5th of a page width. When performing a smart zoom would not significantly change the zoom level, it will be ignored.
The zoom center (x,y) is represented in the screen space, whose origin is at the upper-left corner of the screen region.
x | the horizontal coordinate to look for a text block. |
---|---|
y | the vertical coordinate to look for a text block. |
Returns the point within the document geometry that is closest to another arbitrary point in screen space
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
Creates a new state at the top of the undo/redo chain by taking a snapshot.
meta_info | meta-data to be attached to this new state. |
---|
PDFNetException | PDFNet exception |
---|
Turn to next or previous page in non-continuous mode when at the edge if possible
currentPage | current page |
---|---|
nextPage | true if turn to next page, false if turn to previous page |
Return to the previous state in the undo/redo chain. Returns any meta-data associated with that state.
PDFNetException | PDFNet exception |
---|
Redraws the area covered with a given annotation.
annot | the annotation whose occupied region is to be updated |
---|---|
page_num | the number of the page that the annotation belongs to |
PDFNetException |
---|
Redraws the contents.
all | if true, all the rendered contents are discarded and re-rendered; otherwise, only the visible region will be re-rendered. |
---|
PDFNetException |
---|
Redraws the given area in the client space.
Note: For details about client space, please refer to convScreenPtToCanvasPt(double, double)
.
rec | the rectangle specifying the given area |
---|
PDFNetException |
---|
Redraws all instances (Widgets) of the field.
field | the field for which to update all occurances |
---|
PDFNetException |
---|
This method is deprecated.
Updated the current Optional Content Group (OCG) context associated
with this PDFViewCtrl. This call might be helpful after, for example,
a stamp has been added to the document.
PDFNetException | PDFNet exception |
---|
Updates the page layout within the view. This function must be called after document page sequence is modified (such as when a page is being added to or removed from a document) or after changes to page dimensions (e.g. after a page is rotated or resized).
PDFNetException |
---|
Waits about specified milliseconds or until the visible region is done rendering, whichever is less.
Note: When PDFViewCtrl has to re-render its visible region, say after
update()
is called, it might be desirable to
call this method so that before #onDraw(Canvas)
is called by OS, the new content will already be ready. This helps
to avoid flickering.
If docUnlock()
also has to be called, it should
be called before this function.
milliseconds | milli-seconds to wait up to |
---|
Waits about 1500 milliseconds or until the visible region is done
rendering, whichever is less. Please refer to
waitForRendering(int)
for more details.
Checks if annotations of the given page have been prepared.
pageNum | page number |
---|
Checks if words of the given page have been prepared.
pageNum | page number |
---|