public class

ToolManager

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.tools.ToolManager

Class Overview

This class implements the com.pdftron.pdf.PDFViewCtrl.ToolManager interface. The ToolManager interface is basically a listener for the several different events triggered by PDFViewCtrl, including gesture, layout and custom events.

The Tool interface defined in this class is used to propagate these events to the different tools, so making it possible to control which actions to execute upon such events. Each concrete Tool implementation decides which is the next tool, and the ToolManager uses the getNextToolMode() to check if it must stop the event loop or create a new tool and continue to propagate the event.

For example, the code for onDown(MotionEvent) is as below:

 if (mTool != null) {
     ToolMode prev_tm = mTool.getAnnotType(), next_tm;
     do {
         mTool.onDown(e);
         next_tm = mTool.getNextToolMode();
         if (prev_tm != next_tm) {
             mTool = createTool(next_tm, mTool);
             prev_tm = next_tm;
         } else {
             break;
         }
     } while (true);
 }
 

With this being said, a Tool implementation should prevent forming tools in a cyclic way.

Summary

Nested Classes
interface ToolManager.AdvancedAnnotationListener This interface can be used to monitor advanced annotation events from various tools. 
interface ToolManager.AnnotationModificationListener This interface can be used to monitor annotation modification events such as added/edited/removed. 
interface ToolManager.AnnotationToolbarListener This interface can be used to monitor tools interaction with annotation toolbar  
interface ToolManager.BasicAnnotationListener This interface can be used to monitor basic annotation events such as selected/unselected. 
interface ToolManager.ExternalAnnotationManagerListener This interface can be used to provide custom key for annotation creation  
interface ToolManager.OnGenericMotionEventListener This interface can be used to monitor generic motion event  
interface ToolManager.OnLayoutListener This interface can be used to listen for when the PDFViewCtrl's onLayout() is triggered. 
interface ToolManager.PdfDocModificationListener This interface can be used to monitor any modification events that change the structure of the PDF document such as page manipulation, bookmark modification, etc. 
interface ToolManager.PreToolManagerListener This interface can be used to avoid executing Tool's code in the ToolManager implementation (the events will be called before Tool's ones). 
interface ToolManager.QuickMenuListener This interface can be used to detect if the built-in Tools quick menu item has been clicked. 
interface ToolManager.SpecialAnnotationListener  
interface ToolManager.Tool This interface is used to forward events from com.pdftron.pdf.PDFViewCtrl.ToolManager to the actual implementation of the Tool. 
interface ToolManager.ToolChangedListener This interface can be used to listen for when the current tool changes. 
enum ToolManager.ToolMode Tool modes  
interface ToolManager.ToolModeBase Base tool mode  
Public Constructors
ToolManager(PDFViewCtrl pdfViewCtrl)
Class constructor.
Public Methods
void addAnnotationModificationListener(ToolManager.AnnotationModificationListener listener)
void addCustomizedTool(HashMap<ToolManager.ToolModeBase, Class<? extends Tool>> toolClassMap)
Add a custom tool to tool class map
void addCustomizedTool(Tool tool, Object... params)
Add a custom tool to tool class map
void addCustomizedTool(Tool tool)
Add a custom tool to tool class map
void addCustomizedToolParams(HashMap<ToolManager.ToolModeBase, Object[]> toolParamMap)
Add a custom tool to tool class map
void addOnLayoutListener(ToolManager.OnLayoutListener listener)
void addPdfDocModificationListener(ToolManager.PdfDocModificationListener listener)
void addToolChangedListener(ToolManager.ToolChangedListener listener)
void annotationCouldNotBeAdded(String errorMessage)
Lets various tools raise the annotation could not be add event from a unified location.
boolean canResumePdfDocWithoutReloading()
Pan createDefaultTool()
Creates the default tool (Pan tool).
ToolManager.Tool createTool(ToolManager.ToolModeBase newTool, ToolManager.Tool currentTool)
Creates the specified tool and copies the necessary info from the previous tool if provided.
void deselectAll()
Deselects all annotations
void destroy()
Cleans up resources.
void disableAnnotEditing(Integer[] annotTypes)
Disables annotation editing by type.
void disableToolMode(ToolMode[] toolModes)
Disables tool modes.
boolean editInkAnnots()
Gets whether editing ink annotation should open the annotation toolbar
void enableAnnotEditing(Integer[] annotTypes)
Enables annotation editing by type.
void enableAnnotManager(String userId)
Enables annotation manager for annotation syncing
void enableAnnotManager(String userId, Bundle initialAnnot, AnnotManager.AnnotationSyncingListener listener)
Enables annotation manager for annotation syncing
void enableAnnotManager(String userId, AnnotManager.AnnotationSyncingListener listener)
Enables annotation manager for annotation syncing
void enableAnnotationLayer()
Enable separate rendering layer for annotations.
void enableToolMode(ToolMode[] toolModes)
Enables tool modes.
String generateKey()
boolean getAddImageStamperTool()
Gets whether image stamper tool is enabled
AnnotManager getAnnotManager()
ArrayList<ToolManager.ToolMode> getAnnotToolbarPrecedence()
Gets the precedence of tool mode in Annotation Toolbar
int getAnnotationToolbarHeight()
Gets the annotation toolbar height
String getAuthorId()
Gets the user ID used for checking whether an annotation is created by current user.
String getCacheFileName()
FragmentActivity getCurrentActivity()
Get the activity to which the ToolManager is currently attached, or null if not attached.
static ToolManager.ToolMode getDefaultToolMode(ToolManager.ToolModeBase toolModeBase)
String getDigitalSignatureKeystore()
Gets digital signature keystore file path
String getDigitalSignatureKeystorePassword()
Gets digital signature keystore password
String getFreeTextCacheFileName()
Set<String> getFreeTextFonts()
Gets the list of free text fonts to have as options in the properties popup
ArrayList<ToolManager.Tool> getOldTools()
PDFViewCtrl getPDFViewCtrl()
String getSelectedAnnotId()
Gets the identification of the selected annotation
boolean getStickyNoteShowPopup()
Gets whether shows stick note pop up dialog
TextToSpeech getTTS()
Gets the Text To Speech object
ToolManager.Tool getTool()
Gets the current ToolManager.Tool instance.
int getToolbarHeight()
Gets the toolbar height
UndoRedoManager getUndoRedoManger()
Gets the undo redo manager
void handleAnnotationChanged(String lastChange, boolean init, JSONArray annotDataList)
void handleGotNewAnnotationData(String uuid, String annotId, String userId, String xfdfCommand, String annotParams)
void handleUnreadMessageCountChanged(JSONArray annotDataList)
boolean hasAnnotToolbarPrecedence()
Gets whether precedence is set in Annotation Toolbar
boolean hasCurrentActivity()
Whether ToolManager is currently attached with an activity
void hideBuiltInPageNumber()
Hide built in page number indicator
void initTTS()
Initialize system Text To Speech
boolean isAnnotEditingDisabled(int annotType)
Checks whether the editing of an annot type is disabled.
boolean isAnnotPermissionCheckEnabled()
Gets whether annotation author permission is enabled
boolean isAutoResizeFreeText()
Gets whether can auto resize free text when editing
boolean isAutoSelectAnnotation()
Gets auto select annotation after annotation is created
boolean isBuiltInPageNumberIndicatorVisible()
Indicates whether to use/show the built-in page number indicator.
boolean isCopyAnnotatedTextToNoteEnabled()
Gets whether to copy annotated text to note
boolean isCreatingAnnotation()
The overload implementation of PDFViewCtrl.ToolManager#isCreatingAnnotation().
boolean isDoubleTapToZoom()
Gets whether can double tap to zoom
boolean isEditFreeTextOnTap()
Gets whether can edit FreeText on tap
boolean isInkSmoothingEnabled()
Gets whether to smooth ink annotation
boolean isNightMode()
Gets whether night mode is enabled for tools
boolean isOpenEditToolbarFromPan()
Gets whether edit tool will open when tools selected in pan quick menu
boolean isQuickMenuDisabled()
Gets whether quick menu is disabled
boolean isQuickMenuJustClosed()
boolean isReadOnly()
Gets whether the file associated with PDFViewCtrl is read-only.
boolean isRealTimeAnnotEdit()
Gets whether annotation editing is real time
boolean isShowAnnotIndicators()
Gets whether annotation indicator is showing for annotations with comments
boolean isShowAuthorDialog()
Gets whether to show author dialog the first time when user annotates.
boolean isShowSavedSignature()
Gets whether can show saved signature in signature dialog
boolean isShowSignatureFromImage()
Gets whether can show pick signature from image in signature dialog
boolean isSkipNextTapEvent()
boolean isStylusAsPen()
Gets whether to use stylus to draw without entering ink tool
boolean isTextMarkupAdobeHack()
Gets whether the TextMarkup annotations are compatible with Adobe (Adobe's quads don't follow the specification, but they don't handle quads that do).
boolean isToolModeDisabled(ToolManager.ToolMode toolMode)
Checks whether the specified tool mode is disabled.
void onActionCompleted(Action action)
The overload implementation of PDFViewCtrl.ActionCompletedListener#onActionCompleted(Action).
void onAnnotPainterUpdated(int page, long which, CurvePainter painter)
void onAttachFileSelected(PointF targetPoint)
Pass the file attachment selected event.
void onChangePointerIcon(PointerIcon pointerIcon)
The overload implementation of PDFViewCtrl.ToolManager#onChangePointerIcon(PointerIcon).
void onClose()
The overload implementation of PDFViewCtrl.ToolManager#onClose().
void onConfigurationChanged(Configuration newConfig)
The overload implementation of PDFViewCtrl.ToolManager#onConfigurationChanged(Configuration).
void onControlReady()
The overload implementation of PDFViewCtrl.ToolManager#onControlReady().
void onCustomEvent(Object obj)
The overload implementation of PDFViewCtrl.ToolManager#onCustomEvent(Object).
void onDestroy()
void onDocumentDownloadEvent(PDFViewCtrl.DownloadState mode, int page_num, int page_downloaded, int page_count, String message)
The overload implementation of PDFViewCtrl.ToolManager#onDocumentDownloadEvent(PDFViewCtrl.DownloadState, int, int, int, String).
boolean onDoubleTap(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onDoubleTap(MotionEvent).
void onDoubleTapEnd(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onDoubleTapEnd(MotionEvent).
boolean onDoubleTapEvent(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onDoubleTapEvent(MotionEvent).
void onDoubleTapZoomAnimationBegin()
The overload implementation of PDFViewCtrl.ToolManager#onDoubleTapZoomAnimationBegin().
void onDoubleTapZoomAnimationEnd()
The overload implementation of PDFViewCtrl.ToolManager#onDoubleTapZoomAnimationEnd().
boolean onDown(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onDown(MotionEvent).
void onDraw(Canvas canvas, Matrix tfm)
The overload implementation of PDFViewCtrl.ToolManager#onDraw(Canvas, Matrix).
boolean onDrawEdgeEffects(Canvas canvas, int width, int verticalOffset)
The overload implementation of PDFViewCtrl.ToolManager#onDrawEdgeEffects(Canvas, int, int).
void onFileAttachmentSelected(FileAttachment fileAttachment)
Lets various tools raise the file attachment selected event.
boolean onFlingStop()
The overload implementation of PDFViewCtrl.ToolManager#onFlingStop().
void onFreehandStylusUsedFirstTime()
Lets various tools raise the freehand stylus used for the first time event.
boolean onGenericMotionEvent(MotionEvent event)
The overload implementation of PDFViewCtrl.ToolManager#onGenericMotionEvent(MotionEvent).
void onImageSignatureSelected(PointF targetPoint, int targetPage, Long widget)
Pass the image signature selected event.
void onImageStamperSelected(PointF targetPoint)
Pass the image stamper selected event.
void onInkEditSelected(Annot inkAnnot)
Pass the ink edit selected event.
void onInlineFreeTextEditingStarted()
Pass inline free text editing started event.
boolean onKeyUp(int keyCode, KeyEvent event)
The overload implementation of PDFViewCtrl.ToolManager#onKeyUp(int, KeyEvent).
void onLayout(boolean changed, int l, int t, int r, int b)
The overload implementation of PDFViewCtrl.ToolManager#onLayout(boolean, int, int, int, int).
boolean onLongPress(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onLongPress(MotionEvent).
boolean onMove(MotionEvent e1, MotionEvent e2, float x_dist, float y_dist)
The overload implementation of PDFViewCtrl.ToolManager#onMove(MotionEvent, MotionEvent, float, float).
void onNewFileCreated(File file)
void onOpenAnnotationToolbar(ToolManager.ToolMode mode)
Called when the annotation toolbar should open for a tool
void onOpenEditToolbar(ToolManager.ToolMode mode)
Called when the edit toolbar should open for a tool
void onPageTurning(int old_page, int cur_page)
The overload implementation of PDFViewCtrl.ToolManager#onPageTurning(int, int).
boolean onPointerDown(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onPointerDown(MotionEvent).
void onPostSingleTapConfirmed()
The overload implementation of PDFViewCtrl.ToolManager#onPostSingleTapConfirmed().
void onPullEdgeEffects(int which_edge, float delta_distance)
The overload implementation of PDFViewCtrl.ToolManager#onPullEdgeEffects(int, float).
boolean onQuickMenuClicked(QuickMenuItem menuItem)
void onQuickMenuDismissed()
a callback to be invoked when quick menu is dismissed
void onQuickMenuShown()
a callback to be invoked when quick menu is shown
void onReleaseEdgeEffects()
The overload implementation of PDFViewCtrl.ToolManager#onReleaseEdgeEffects().
void onRenderingFinished()
The overload implementation of PDFViewCtrl.ToolManager#onRenderingFinished().
boolean onScale(float x, float y)
The overload implementation of PDFViewCtrl.ToolManager#onScale(float, float).
boolean onScaleBegin(float x, float y)
The overload implementation of PDFViewCtrl.ToolManager#onScaleBegin(float, float).
boolean onScaleEnd(float x, float y)
The overload implementation of PDFViewCtrl.ToolManager#onScaleEnd(float, float).
void onScrollChanged(int l, int t, int oldl, int oldt)
The overload implementation of PDFViewCtrl.ToolManager#onScrollChanged(int, int, int, int).
void onSetDoc()
The overload implementation of PDFViewCtrl.ToolManager#onSetDoc().
boolean onShowPress(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onShowPress(MotionEvent).
boolean onShowQuickMenu(Annot annot)
a callback to be invoked when quick menu is about to show
boolean onSingleTapConfirmed(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onSingleTapConfirmed(MotionEvent).
boolean onSingleTapUp(MotionEvent e)
The overload implementation of PDFViewCtrl.ToolManager#onSingleTapUp(MotionEvent).
boolean onUp(MotionEvent e, PDFViewCtrl.PriorEventMode priorEventMode)
The overload implementation of PDFViewCtrl.ToolManager#onUp(MotionEvent, PDFViewCtrl.PriorEventMode).
void raiseAllAnnotationsRemovedEvent()
Call this function when all annotations in the document have been removed.
void raiseAnnotationActionEvent()
Call this function when an action has taken place that changes the document.
void raiseAnnotationsAddedEvent(Map<Annot, Integer> annots)
Call this function when annotations have been added to the document.
void raiseAnnotationsModifiedEvent(Map<Annot, Integer> annots, Bundle bundle)
Call this function when annotations in the document have been modified.
void raiseAnnotationsPreModifyEvent(Map<Annot, Integer> annots)
Call this function before annotations in the document are modified.
void raiseAnnotationsPreRemoveEvent(Map<Annot, Integer> annots)
Call this function before annotations are removed from the document.
void raiseAnnotationsRemovedEvent(Map<Annot, Integer> annots)
Call this function when annotations have been removed from the document.
void raiseAnnotationsRemovedEvent(int pageNum)
Call this function when all annotations in the specified page have been removed from the document.
void raiseBookmarkModified()
Call this function when document bookmark has been modified.
boolean raiseInterceptAnnotationHandlingEvent(Annot annot, Bundle extra, ToolManager.ToolMode toolMode)
Handle annotation
boolean raiseInterceptDialogEvent(AlertDialog dialog)
Call this function when a dialog is about to show up.
void raisePageLabelChangedEvent()
Call this function when the page labels have changed in this document.
void raisePageMoved(int from, int to)
Call this function when a page in the document have been moved to a new position.
void raisePagesAdded(List<Integer> pageList)
Call this function when new pages have been added to the document.
void raisePagesCropped()
Call this function when pages of the document have been cropped.
void raisePagesDeleted(List<Integer> pageList)
Call this function when pages have been deleted from the document.
void raisePagesRotated(List<Integer> pageList)
Call this function when pages in the document have been rotated.
void removeAnnotationModificationListener(ToolManager.AnnotationModificationListener listener)
void removeOnLayoutListener(ToolManager.OnLayoutListener listener)
void removePdfDocModificationListener(ToolManager.PdfDocModificationListener listener)
void removeToolChangedListener(ToolManager.ToolChangedListener listener)
void reselectAnnot()
Re-selects the last selected annotation
void resetIndicator()
Resets annotation indicators
void resetSkipNextTapEvent()
Resets skipping the next tap event.
void selectAnnot(Annot annot, int pageNum)
Selects an annotation
void selectAnnot(String annotId, int pageNum)
Selects the annotation.
void setAddImageStamperTool(boolean addImageStamperTool)
Sets whether to enable image stamper tool
void setAdvancedAnnotationListener(ToolManager.AdvancedAnnotationListener listener)
void setAnnotPermissionCheckEnabled(boolean enable)
Sets whether to check annotation author permission
void setAnnotToolbarPrecedence(ToolMode[] toolModes)
Sets an array that determines which tool icon should show when space is limited (portrait mode on small devices when collapsed)
void setAnnotationToolbarListener(ToolManager.AnnotationToolbarListener annotationToolbarListener)
void setAuthorId(String authorId)
Sets the user ID used for checking whether an annotation is created by current user.
void setAutoResizeFreeText(boolean autoResizeFreeText)
Sets whether can auto resize free text when editing
void setAutoSelectAnnotation(boolean autoSelect)
Sets whether auto select annotation after annotation is created
void setBasicAnnotationListener(ToolManager.BasicAnnotationListener listener)
void setBuiltInPageNumberIndicatorVisible(boolean visible)
Indicates whether to use/show the built-in page number indicator.
void setCacheFileName(String tag)
Sets the cache file name
void setCanOpenEditToolbarFromPan(boolean canOpenEditToolbarFromPan)
Sets whether edit tool will open when tools selected in pan quick menu
void setCanResumePdfDocWithoutReloading(boolean canResumePdfDocWithoutReloading)
Sets if can resume PDF Doc without reloading.
void setCopyAnnotatedTextToNoteEnabled(boolean enable)
Sets whether to copy annotated text to note
void setCurrentActivity(FragmentActivity activity)
Set the activity to which the ToolManager is currently attached, or null if not attached.
void setDefaultToolCLass(Class<? extends Pan> cLass)
set default tool class
void setDigitalSignatureKeystorePassword(String digitalSignatureKeystore)
Sets digital signature keystore password
void setDigitalSignatureKeystorePath(String digitalSignatureKeystore)
Sets digital signature keystore file path
void setDisableQuickMenu(boolean disabled)
Sets whether disable showing the long press quick menu
void setDoubleTapToZoom(boolean doubleTapToZoom)
Sets whether can double tap to zoom the viewer
void setEditFreeTextOnTap(boolean editFreeTextOnTap)
Sets whether can edit FreeText on tap
void setEditInkAnnots(boolean editInkAnnots)
Sets whether editing ink annotation should open the annotation toolbar
void setExternalAnnotationManagerListener(ToolManager.ExternalAnnotationManagerListener externalAnnotationManagerListener)
void setFreeTextFonts(Set<String> freeTextFonts)
Sets list of free text fonts to have as options in the properties popup.
void setInkSmoothingEnabled(boolean enable)
Sets whether to smooth ink annotation
void setNightMode(boolean isNightMode)
Sets whether night mode is enabled
void setOnGenericMotionEventListener(ToolManager.OnGenericMotionEventListener onGenericMotionEventListener)
void setPreToolManagerListener(ToolManager.PreToolManagerListener listener)
void setQuickMenuJustClosed(boolean closed)
Sets whether the quick menu is just closed.
void setQuickMenuListener(ToolManager.QuickMenuListener listener)
void setReadOnly(boolean readOnly)
Indicates whether the file associated with PDFViewCtrl is read-only.
void setRealTimeAnnotEdit(boolean realTimeAnnotEdit)
Sets whether annotation editing is real time
void setSelectedAnnot(Annot annot, int pageNum)
Sets the selected annotation identification
void setShowAnnotIndicators(boolean showAnnotIndicators)
Sets whether annotation indicator is showing for annotations with comments
void setShowAuthorDialog(boolean show)
Sets whether to show author dialog the first time when user annotates.
void setShowSavedSignatures(boolean showSavedSignature)
Sets whether can show saved signature in signature dialog
void setShowSignatureFromImage(boolean showSignatureFromImage)
Sets whether can show pick signature from image in signature dialog
void setStickyNoteShowPopup(boolean show)
Sets whether show pop up dialog when sticky note is added/ selected/ etc.
void setStylusAsPen(boolean stylusAsPen)
Sets whether to use stylus to draw without entering ink tool
void setTextMarkupAdobeHack(boolean enable)
Sets whether the TextMarkup annotations are compatible with Adobe (Adobe's quads don't follow the specification, but they don't handle quads that do).
void setTool(ToolManager.Tool t)
Sets the current ToolManager.Tool instance.
void showBuiltInPageNumber()
Show built in page number indicator
void skipNextTapEvent()
Skips the next tap event.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ToolManager (PDFViewCtrl pdfViewCtrl)

Class constructor.

Parameters
pdfViewCtrl the com.pdftron.pdf.PDFViewCtrl. It must not be null.

Public Methods

public void addAnnotationModificationListener (ToolManager.AnnotationModificationListener listener)

Parameters
listener the listener

public void addCustomizedTool (HashMap<ToolManager.ToolModeBase, Class<? extends Tool>> toolClassMap)

Add a custom tool to tool class map

Parameters
toolClassMap customized tool mode and class map

public void addCustomizedTool (Tool tool, Object... params)

Add a custom tool to tool class map

Parameters
tool customized tool.
params parameter for instantiate tool

public void addCustomizedTool (Tool tool)

Add a custom tool to tool class map

Parameters
tool customized tool

public void addCustomizedToolParams (HashMap<ToolManager.ToolModeBase, Object[]> toolParamMap)

Add a custom tool to tool class map

Parameters
toolParamMap tool mode and tool initialize parameter map

public void addOnLayoutListener (ToolManager.OnLayoutListener listener)

Parameters
listener the listener

public void addPdfDocModificationListener (ToolManager.PdfDocModificationListener listener)

Parameters
listener the listener

public void addToolChangedListener (ToolManager.ToolChangedListener listener)

Parameters
listener the listener

public void annotationCouldNotBeAdded (String errorMessage)

Lets various tools raise the annotation could not be add event from a unified location.

public boolean canResumePdfDocWithoutReloading ()

Returns
  • True if can resume PDF Doc without reloading

public Pan createDefaultTool ()

Creates the default tool (Pan tool). If instantiate default tool failed, it will create Pan tool

Returns
  • the default tool

public ToolManager.Tool createTool (ToolManager.ToolModeBase newTool, ToolManager.Tool currentTool)

Creates the specified tool and copies the necessary info from the previous tool if provided.

Parameters
newTool the identifier for the tool to be created
currentTool the current tool before this call

public void deselectAll ()

Deselects all annotations

public void destroy ()

Cleans up resources.

public void disableAnnotEditing (Integer[] annotTypes)

Disables annotation editing by type.

Parameters
annotTypes annot types to be disabled

public void disableToolMode (ToolMode[] toolModes)

Disables tool modes. Pan tool cannot be disabled.

Parameters
toolModes tool modes to be disabled

public boolean editInkAnnots ()

Gets whether editing ink annotation should open the annotation toolbar

Returns
  • true if can edit ink annotation via annotation toolbar, false otherwise

public void enableAnnotEditing (Integer[] annotTypes)

Enables annotation editing by type.

Parameters
annotTypes annot types to be enabled

public void enableAnnotManager (String userId)

Enables annotation manager for annotation syncing

Parameters
userId the unique identifier of the current user

public void enableAnnotManager (String userId, Bundle initialAnnot, AnnotManager.AnnotationSyncingListener listener)

Enables annotation manager for annotation syncing

Parameters
userId the unique identifier of the current user
initialAnnot if set, viewer will jump to the set annotation automatically
listener the AnnotManager.AnnotationSyncingListener

public void enableAnnotManager (String userId, AnnotManager.AnnotationSyncingListener listener)

Enables annotation manager for annotation syncing

Parameters
userId the unique identifier of the current user
listener the AnnotManager.AnnotationSyncingListener

public void enableAnnotationLayer ()

Enable separate rendering layer for annotations. Once enabled, can no longer disable in the same session.

public void enableToolMode (ToolMode[] toolModes)

Enables tool modes.

Parameters
toolModes tool modes to be enabled

public String generateKey ()

Returns
  • The generated key

public boolean getAddImageStamperTool ()

Gets whether image stamper tool is enabled

Returns
  • true if enabled, false otherwise

public AnnotManager getAnnotManager ()

Returns
  • The annotation manager

public ArrayList<ToolManager.ToolMode> getAnnotToolbarPrecedence ()

Gets the precedence of tool mode in Annotation Toolbar

Returns
  • the tool modes in the order of importance

public int getAnnotationToolbarHeight ()

Gets the annotation toolbar height

Returns
  • annotation toolbar height in pixel, -1 if annotation toolbar not visible

public String getAuthorId ()

Gets the user ID used for checking whether an annotation is created by current user.

Returns
  • auther identification

public String getCacheFileName ()

Returns
  • The cache file name

public FragmentActivity getCurrentActivity ()

Get the activity to which the ToolManager is currently attached, or null if not attached. DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSE MEMORY LEAKS.

public static ToolManager.ToolMode getDefaultToolMode (ToolManager.ToolModeBase toolModeBase)

public String getDigitalSignatureKeystore ()

Gets digital signature keystore file path

Returns
  • the digital signature keystore file path

public String getDigitalSignatureKeystorePassword ()

Gets digital signature keystore password

Returns
  • the digital signature keystore password

public String getFreeTextCacheFileName ()

Returns
  • The free text cache file name

public Set<String> getFreeTextFonts ()

Gets the list of free text fonts to have as options in the properties popup

public ArrayList<ToolManager.Tool> getOldTools ()

Returns
  • the list of old tools

public PDFViewCtrl getPDFViewCtrl ()

Returns
  • The PDFViewCtrl

public String getSelectedAnnotId ()

Gets the identification of the selected annotation

Returns
  • identification

public boolean getStickyNoteShowPopup ()

Gets whether shows stick note pop up dialog

Returns
  • true if shows, false otherwise

public TextToSpeech getTTS ()

Gets the Text To Speech object

Returns
  • TextToSpeech object

public ToolManager.Tool getTool ()

Gets the current ToolManager.Tool instance.

public int getToolbarHeight ()

Gets the toolbar height

Returns
  • toolbar height in pixel, -1 if annotation toolbar not visible

public UndoRedoManager getUndoRedoManger ()

Gets the undo redo manager

Returns
  • undo redo manager

public void handleAnnotationChanged (String lastChange, boolean init, JSONArray annotDataList)

public void handleGotNewAnnotationData (String uuid, String annotId, String userId, String xfdfCommand, String annotParams)

public void handleUnreadMessageCountChanged (JSONArray annotDataList)

public boolean hasAnnotToolbarPrecedence ()

Gets whether precedence is set in Annotation Toolbar

Returns
  • true if there is precedence, false otherwise

public boolean hasCurrentActivity ()

Whether ToolManager is currently attached with an activity

public void hideBuiltInPageNumber ()

Hide built in page number indicator

public void initTTS ()

Initialize system Text To Speech

public boolean isAnnotEditingDisabled (int annotType)

Checks whether the editing of an annot type is disabled.

Parameters
annotType The annot type
Returns
  • True if editing of the annot type is disabled

public boolean isAnnotPermissionCheckEnabled ()

Gets whether annotation author permission is enabled

Returns
  • true if enabled, false otherwise

public boolean isAutoResizeFreeText ()

Gets whether can auto resize free text when editing

Returns
  • true if can auto resize, false otherwise

public boolean isAutoSelectAnnotation ()

Gets auto select annotation after annotation is created

Returns
  • true if auto select, false otherwise

public boolean isBuiltInPageNumberIndicatorVisible ()

Indicates whether to use/show the built-in page number indicator.

Returns
  • true to show the built-in page number indicator, false otherwise.

public boolean isCopyAnnotatedTextToNoteEnabled ()

Gets whether to copy annotated text to note

Returns
  • true if enabled, false otherwise

public boolean isCreatingAnnotation ()

The overload implementation of PDFViewCtrl.ToolManager#isCreatingAnnotation().

public boolean isDoubleTapToZoom ()

Gets whether can double tap to zoom

Returns
  • true if can double tap to zoom, false otherwise

public boolean isEditFreeTextOnTap ()

Gets whether can edit FreeText on tap

Returns
  • true if start edit on tap, false otherwise

public boolean isInkSmoothingEnabled ()

Gets whether to smooth ink annotation

Returns
  • true if enabled, false otherwise

public boolean isNightMode ()

Gets whether night mode is enabled for tools

Returns
  • true if enabled, false otherwise

public boolean isOpenEditToolbarFromPan ()

Gets whether edit tool will open when tools selected in pan quick menu

Returns
  • true if click tools from quick menu will open the edit toolbar in pan mode, false otherwise

public boolean isQuickMenuDisabled ()

Gets whether quick menu is disabled

Returns
  • true if disabled, false otherwise

public boolean isQuickMenuJustClosed ()

Returns
  • True if the quick menu is just closed

public boolean isReadOnly ()

Gets whether the file associated with PDFViewCtrl is read-only.

public boolean isRealTimeAnnotEdit ()

Gets whether annotation editing is real time

Returns
  • true if real time, false otherwise

public boolean isShowAnnotIndicators ()

Gets whether annotation indicator is showing for annotations with comments

Returns
  • true if enabled, false otherwise

public boolean isShowAuthorDialog ()

Gets whether to show author dialog the first time when user annotates.

public boolean isShowSavedSignature ()

Gets whether can show saved signature in signature dialog

Returns
  • true if show saved signatures, false otherwise

public boolean isShowSignatureFromImage ()

Gets whether can show pick signature from image in signature dialog

Returns
  • true if show image picking icon, false otherwise

public boolean isSkipNextTapEvent ()

Returns
  • True if next tap event is skipped.

public boolean isStylusAsPen ()

Gets whether to use stylus to draw without entering ink tool

Returns
  • true if enabled, false otherwise

public boolean isTextMarkupAdobeHack ()

Gets whether the TextMarkup annotations are compatible with Adobe (Adobe's quads don't follow the specification, but they don't handle quads that do).

public boolean isToolModeDisabled (ToolManager.ToolMode toolMode)

Checks whether the specified tool mode is disabled.

Parameters
toolMode The tool mode
Returns
  • True if the tool mode is disabled

public void onActionCompleted (Action action)

The overload implementation of PDFViewCtrl.ActionCompletedListener#onActionCompleted(Action).

public void onAnnotPainterUpdated (int page, long which, CurvePainter painter)

public void onAttachFileSelected (PointF targetPoint)

Pass the file attachment selected event.

Parameters
targetPoint target location to add the image stamp

public void onChangePointerIcon (PointerIcon pointerIcon)

The overload implementation of PDFViewCtrl.ToolManager#onChangePointerIcon(PointerIcon).

public void onClose ()

The overload implementation of PDFViewCtrl.ToolManager#onClose().

public void onConfigurationChanged (Configuration newConfig)

The overload implementation of PDFViewCtrl.ToolManager#onConfigurationChanged(Configuration).

public void onControlReady ()

The overload implementation of PDFViewCtrl.ToolManager#onControlReady().

public void onCustomEvent (Object obj)

The overload implementation of PDFViewCtrl.ToolManager#onCustomEvent(Object).

public void onDestroy ()

public void onDocumentDownloadEvent (PDFViewCtrl.DownloadState mode, int page_num, int page_downloaded, int page_count, String message)

The overload implementation of PDFViewCtrl.ToolManager#onDocumentDownloadEvent(PDFViewCtrl.DownloadState, int, int, int, String).

public boolean onDoubleTap (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onDoubleTap(MotionEvent).

public void onDoubleTapEnd (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onDoubleTapEnd(MotionEvent).

public boolean onDoubleTapEvent (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onDoubleTapEvent(MotionEvent).

public void onDoubleTapZoomAnimationBegin ()

The overload implementation of PDFViewCtrl.ToolManager#onDoubleTapZoomAnimationBegin().

public void onDoubleTapZoomAnimationEnd ()

The overload implementation of PDFViewCtrl.ToolManager#onDoubleTapZoomAnimationEnd().

public boolean onDown (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onDown(MotionEvent).

public void onDraw (Canvas canvas, Matrix tfm)

The overload implementation of PDFViewCtrl.ToolManager#onDraw(Canvas, Matrix).

public boolean onDrawEdgeEffects (Canvas canvas, int width, int verticalOffset)

The overload implementation of PDFViewCtrl.ToolManager#onDrawEdgeEffects(Canvas, int, int).

public void onFileAttachmentSelected (FileAttachment fileAttachment)

Lets various tools raise the file attachment selected event.

Parameters
fileAttachment the selected file attachment

public boolean onFlingStop ()

The overload implementation of PDFViewCtrl.ToolManager#onFlingStop().

public void onFreehandStylusUsedFirstTime ()

Lets various tools raise the freehand stylus used for the first time event.

public boolean onGenericMotionEvent (MotionEvent event)

The overload implementation of PDFViewCtrl.ToolManager#onGenericMotionEvent(MotionEvent).

public void onImageSignatureSelected (PointF targetPoint, int targetPage, Long widget)

Pass the image signature selected event.

Parameters
targetPoint target page location to add the image signature
targetPage target page number to add the image signature
widget target form widget to add the image signature (only one of target point or widget will be valid)

public void onImageStamperSelected (PointF targetPoint)

Pass the image stamper selected event.

Parameters
targetPoint target location to add the image stamp

public void onInkEditSelected (Annot inkAnnot)

Pass the ink edit selected event.

Parameters
inkAnnot the ink annotation to be modified

public void onInlineFreeTextEditingStarted ()

Pass inline free text editing started event.

public boolean onKeyUp (int keyCode, KeyEvent event)

The overload implementation of PDFViewCtrl.ToolManager#onKeyUp(int, KeyEvent).

public void onLayout (boolean changed, int l, int t, int r, int b)

The overload implementation of PDFViewCtrl.ToolManager#onLayout(boolean, int, int, int, int).

public boolean onLongPress (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onLongPress(MotionEvent).

public boolean onMove (MotionEvent e1, MotionEvent e2, float x_dist, float y_dist)

The overload implementation of PDFViewCtrl.ToolManager#onMove(MotionEvent, MotionEvent, float, float).

public void onNewFileCreated (File file)

public void onOpenAnnotationToolbar (ToolManager.ToolMode mode)

Called when the annotation toolbar should open for a tool

Parameters
mode the tool mode

public void onOpenEditToolbar (ToolManager.ToolMode mode)

Called when the edit toolbar should open for a tool

Parameters
mode the tool mode

public void onPageTurning (int old_page, int cur_page)

The overload implementation of PDFViewCtrl.ToolManager#onPageTurning(int, int).

public boolean onPointerDown (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onPointerDown(MotionEvent).

public void onPostSingleTapConfirmed ()

The overload implementation of PDFViewCtrl.ToolManager#onPostSingleTapConfirmed().

public void onPullEdgeEffects (int which_edge, float delta_distance)

The overload implementation of PDFViewCtrl.ToolManager#onPullEdgeEffects(int, float).

public boolean onQuickMenuClicked (QuickMenuItem menuItem)

Parameters
menuItem the menu item. See: QuickMenuItem

public void onQuickMenuDismissed ()

a callback to be invoked when quick menu is dismissed

public void onQuickMenuShown ()

a callback to be invoked when quick menu is shown

public void onReleaseEdgeEffects ()

The overload implementation of PDFViewCtrl.ToolManager#onReleaseEdgeEffects().

public void onRenderingFinished ()

The overload implementation of PDFViewCtrl.ToolManager#onRenderingFinished().

public boolean onScale (float x, float y)

The overload implementation of PDFViewCtrl.ToolManager#onScale(float, float).

public boolean onScaleBegin (float x, float y)

The overload implementation of PDFViewCtrl.ToolManager#onScaleBegin(float, float).

public boolean onScaleEnd (float x, float y)

The overload implementation of PDFViewCtrl.ToolManager#onScaleEnd(float, float).

public void onScrollChanged (int l, int t, int oldl, int oldt)

The overload implementation of PDFViewCtrl.ToolManager#onScrollChanged(int, int, int, int).

public void onSetDoc ()

The overload implementation of PDFViewCtrl.ToolManager#onSetDoc().

public boolean onShowPress (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onShowPress(MotionEvent).

public boolean onShowQuickMenu (Annot annot)

a callback to be invoked when quick menu is about to show

public boolean onSingleTapConfirmed (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onSingleTapConfirmed(MotionEvent).

public boolean onSingleTapUp (MotionEvent e)

The overload implementation of PDFViewCtrl.ToolManager#onSingleTapUp(MotionEvent).

public boolean onUp (MotionEvent e, PDFViewCtrl.PriorEventMode priorEventMode)

The overload implementation of PDFViewCtrl.ToolManager#onUp(MotionEvent, PDFViewCtrl.PriorEventMode).

public void raiseAllAnnotationsRemovedEvent ()

Call this function when all annotations in the document have been removed.

public void raiseAnnotationActionEvent ()

Call this function when an action has taken place that changes the document.

public void raiseAnnotationsAddedEvent (Map<Annot, Integer> annots)

Call this function when annotations have been added to the document.

Parameters
annots map of annotations added

public void raiseAnnotationsModifiedEvent (Map<Annot, Integer> annots, Bundle bundle)

Call this function when annotations in the document have been modified.

Parameters
annots map of annotations modified

public void raiseAnnotationsPreModifyEvent (Map<Annot, Integer> annots)

Call this function before annotations in the document are modified.

Parameters
annots map of annotations about to be modified

public void raiseAnnotationsPreRemoveEvent (Map<Annot, Integer> annots)

Call this function before annotations are removed from the document.

Parameters
annots map of annotations about to be removed

public void raiseAnnotationsRemovedEvent (Map<Annot, Integer> annots)

Call this function when annotations have been removed from the document.

Parameters
annots map of annotations removed

public void raiseAnnotationsRemovedEvent (int pageNum)

Call this function when all annotations in the specified page have been removed from the document.

Parameters
pageNum The page number where the annotations are on

public void raiseBookmarkModified ()

Call this function when document bookmark has been modified.

public boolean raiseInterceptAnnotationHandlingEvent (Annot annot, Bundle extra, ToolManager.ToolMode toolMode)

Handle annotation

Parameters
annot annotation
extra
toolMode tool mode

public boolean raiseInterceptDialogEvent (AlertDialog dialog)

Call this function when a dialog is about to show up.

public void raisePageLabelChangedEvent ()

Call this function when the page labels have changed in this document.

public void raisePageMoved (int from, int to)

Call this function when a page in the document have been moved to a new position.

public void raisePagesAdded (List<Integer> pageList)

Call this function when new pages have been added to the document.

public void raisePagesCropped ()

Call this function when pages of the document have been cropped.

public void raisePagesDeleted (List<Integer> pageList)

Call this function when pages have been deleted from the document.

public void raisePagesRotated (List<Integer> pageList)

Call this function when pages in the document have been rotated.

public void removeAnnotationModificationListener (ToolManager.AnnotationModificationListener listener)

Parameters
listener the listener

public void removeOnLayoutListener (ToolManager.OnLayoutListener listener)

Parameters
listener the listener

public void removePdfDocModificationListener (ToolManager.PdfDocModificationListener listener)

Parameters
listener the listener

public void removeToolChangedListener (ToolManager.ToolChangedListener listener)

Parameters
listener the listener

public void reselectAnnot ()

Re-selects the last selected annotation

public void resetIndicator ()

Resets annotation indicators

public void resetSkipNextTapEvent ()

Resets skipping the next tap event.

public void selectAnnot (Annot annot, int pageNum)

Selects an annotation

Parameters
annot the annotation
pageNum the page number where the annotation is on

public void selectAnnot (String annotId, int pageNum)

Selects the annotation.

Parameters
annotId The annotation ID
pageNum The page number where the annotation is on

public void setAddImageStamperTool (boolean addImageStamperTool)

Sets whether to enable image stamper tool

Parameters
addImageStamperTool if true, image stamper tool will be available

public void setAdvancedAnnotationListener (ToolManager.AdvancedAnnotationListener listener)

Parameters
listener the listener

public void setAnnotPermissionCheckEnabled (boolean enable)

Sets whether to check annotation author permission

Parameters
enable if true, annotation created by user A cannot be modified by user B, else anyone can modify any annotation

public void setAnnotToolbarPrecedence (ToolMode[] toolModes)

Sets an array that determines which tool icon should show when space is limited (portrait mode on small devices when collapsed)

Parameters
toolModes the tool modes in the order of importance

public void setAnnotationToolbarListener (ToolManager.AnnotationToolbarListener annotationToolbarListener)

Parameters
annotationToolbarListener the listener

public void setAuthorId (String authorId)

Sets the user ID used for checking whether an annotation is created by current user.

Parameters
authorId author identification

public void setAutoResizeFreeText (boolean autoResizeFreeText)

Sets whether can auto resize free text when editing

Parameters
autoResizeFreeText if true can auto resize, false otherwise

public void setAutoSelectAnnotation (boolean autoSelect)

Sets whether auto select annotation after annotation is created

Parameters
autoSelect if true, after creating annotation, it will auto select it and show quick menu

public void setBasicAnnotationListener (ToolManager.BasicAnnotationListener listener)

Parameters
listener the listener

public void setBuiltInPageNumberIndicatorVisible (boolean visible)

Indicates whether to use/show the built-in page number indicator.

Parameters
visible true to show the built-in page number indicator, false otherwise.

public void setCacheFileName (String tag)

Sets the cache file name

Parameters
tag The tag which will be used to generate cache file name

public void setCanOpenEditToolbarFromPan (boolean canOpenEditToolbarFromPan)

Sets whether edit tool will open when tools selected in pan quick menu

Parameters
canOpenEditToolbarFromPan if true, click tools from quick menu will open the edit toolbar in pan mode, false otherwise

public void setCanResumePdfDocWithoutReloading (boolean canResumePdfDocWithoutReloading)

Sets if can resume PDF Doc without reloading.

Parameters
canResumePdfDocWithoutReloading True if can resume PDF Doc without reloading

public void setCopyAnnotatedTextToNoteEnabled (boolean enable)

Sets whether to copy annotated text to note

Parameters
enable enable copy annotated text to note

public void setCurrentActivity (FragmentActivity activity)

Set the activity to which the ToolManager is currently attached, or null if not attached.

public void setDefaultToolCLass (Class<? extends Pan> cLass)

set default tool class

Parameters
cLass default tool class

public void setDigitalSignatureKeystorePassword (String digitalSignatureKeystore)

Sets digital signature keystore password

public void setDigitalSignatureKeystorePath (String digitalSignatureKeystore)

Sets digital signature keystore file path

public void setDisableQuickMenu (boolean disabled)

Sets whether disable showing the long press quick menu

Parameters
disabled if true, disable showing the long press quick menu

public void setDoubleTapToZoom (boolean doubleTapToZoom)

Sets whether can double tap to zoom the viewer

Parameters
doubleTapToZoom if true, can double tap to zoom, false otherwise

public void setEditFreeTextOnTap (boolean editFreeTextOnTap)

Sets whether can edit FreeText on tap

Parameters
editFreeTextOnTap true if start edit on tap, false otherwise

public void setEditInkAnnots (boolean editInkAnnots)

Sets whether editing ink annotation should open the annotation toolbar

Parameters
editInkAnnots if true, can edit ink annotation via annotation toolbar, false otherwise

public void setExternalAnnotationManagerListener (ToolManager.ExternalAnnotationManagerListener externalAnnotationManagerListener)

public void setFreeTextFonts (Set<String> freeTextFonts)

Sets list of free text fonts to have as options in the properties popup.

public void setInkSmoothingEnabled (boolean enable)

Sets whether to smooth ink annotation

Parameters
enable enable ink smoothing

public void setNightMode (boolean isNightMode)

Sets whether night mode is enabled

Parameters
isNightMode enable night mode for tools

public void setOnGenericMotionEventListener (ToolManager.OnGenericMotionEventListener onGenericMotionEventListener)

Parameters
onGenericMotionEventListener the listener

public void setPreToolManagerListener (ToolManager.PreToolManagerListener listener)

Parameters
listener the listener

public void setQuickMenuJustClosed (boolean closed)

Sets whether the quick menu is just closed.

Parameters
closed True if the quick menu is just closed

public void setQuickMenuListener (ToolManager.QuickMenuListener listener)

Parameters
listener the listener

public void setReadOnly (boolean readOnly)

Indicates whether the file associated with PDFViewCtrl is read-only.

public void setRealTimeAnnotEdit (boolean realTimeAnnotEdit)

Sets whether annotation editing is real time

Parameters
realTimeAnnotEdit true if real time, false otherwise

public void setSelectedAnnot (Annot annot, int pageNum)

Sets the selected annotation identification

Parameters
annot the annotation
pageNum the page number where the annotation is on

public void setShowAnnotIndicators (boolean showAnnotIndicators)

Sets whether annotation indicator is showing for annotations with comments

Parameters
showAnnotIndicators true if enabled, false otherwise

public void setShowAuthorDialog (boolean show)

Sets whether to show author dialog the first time when user annotates.

public void setShowSavedSignatures (boolean showSavedSignature)

Sets whether can show saved signature in signature dialog

Parameters
showSavedSignature true if show saved signatures, false otherwise

public void setShowSignatureFromImage (boolean showSignatureFromImage)

Sets whether can show pick signature from image in signature dialog

Parameters
showSignatureFromImage true if show pick from image button, false otherwise

public void setStickyNoteShowPopup (boolean show)

Sets whether show pop up dialog when sticky note is added/ selected/ etc.

Parameters
show if true, show sticky note pop up when sticky note is created/ prepare to modify

public void setStylusAsPen (boolean stylusAsPen)

Sets whether to use stylus to draw without entering ink tool

Parameters
stylusAsPen enable inking with stylus in pan mode

public void setTextMarkupAdobeHack (boolean enable)

Sets whether the TextMarkup annotations are compatible with Adobe (Adobe's quads don't follow the specification, but they don't handle quads that do).

public void setTool (ToolManager.Tool t)

Sets the current ToolManager.Tool instance.

There are two ways to set the current tool. One is via createTool(ToolModeBase, com.pdftron.pdf.tools.ToolManager.Tool), which is used during events. The other way is through this method, which allows for setting the tool without any events.

public void showBuiltInPageNumber ()

Show built in page number indicator

public void skipNextTapEvent ()

Skips the next tap event.