Show / Hide Table of Contents

Class ToolManager

The ToolManager class will attach itself to a PDFViewCtrl and provides a lot of interactive features, such as text selection, annotation creation and editing, and form filling.

It is important to Dispose the ToolManager when it is no longer needed. This is because it subscribes to certain events in the PDFViewCtrl that will prevent both the PDFViewCtrl and the ToolManager from being reclaimed by garbage collection.

Inheritance
System.Object
ToolManager
Namespace: pdftron.PDF.Tools
Assembly: pdftron.PDF.Tools.dll
Syntax
public sealed class ToolManager : IDisposable

Constructors

ToolManager(PDFViewCtrl)

Constructor

Declaration
public ToolManager(PDFViewCtrl ctrl)
Parameters
Type Name Description
PDFViewCtrl ctrl

Fields

INK_MARGIN_FOR_STARTING_NEW_ANNOTATION

Declaration
public double INK_MARGIN_FOR_STARTING_NEW_ANNOTATION
Field Value
Type Description
System.Double

INK_TIME_BEFORE_INK_SAVES_ANNOTATION_IN_MILLISECONDS

Declaration
public double INK_TIME_BEFORE_INK_SAVES_ANNOTATION_IN_MILLISECONDS
Field Value
Type Description
System.Double

MOVE_THRESHOLD_TO_START_SCROLL

Declaration
public double MOVE_THRESHOLD_TO_START_SCROLL
Field Value
Type Description
System.Double

TEXT_SELECT_FINGER_HIT_TESTING_MARGIN

Declaration
public static double TEXT_SELECT_FINGER_HIT_TESTING_MARGIN
Field Value
Type Description
System.Double

TEXT_SELECT_SCROLL_HARD_MARGIN_X

Declaration
public double TEXT_SELECT_SCROLL_HARD_MARGIN_X
Field Value
Type Description
System.Double

TEXT_SELECT_SCROLL_HARD_MARGIN_Y

Declaration
public double TEXT_SELECT_SCROLL_HARD_MARGIN_Y
Field Value
Type Description
System.Double

TEXT_SELECT_SCROLL_SOFT_MARGIN_X

Declaration
public double TEXT_SELECT_SCROLL_SOFT_MARGIN_X
Field Value
Type Description
System.Double

TEXT_SELECT_SCROLL_SOFT_MARGIN_Y

Declaration
public double TEXT_SELECT_SCROLL_SOFT_MARGIN_Y
Field Value
Type Description
System.Double

TEXT_SELECT_SCROLL_SPEED_MULTIPLIER_IF_POST_MARGIN_X

Declaration
public double TEXT_SELECT_SCROLL_SPEED_MULTIPLIER_IF_POST_MARGIN_X
Field Value
Type Description
System.Double

TEXT_SELECT_SCROLL_SPEED_MULTIPLIER_IF_POST_MARGIN_Y

Declaration
public double TEXT_SELECT_SCROLL_SPEED_MULTIPLIER_IF_POST_MARGIN_Y
Field Value
Type Description
System.Double

TEXT_SELECT_SCROLL_SPEED_X

Declaration
public double TEXT_SELECT_SCROLL_SPEED_X
Field Value
Type Description
System.Double

TEXT_SELECT_SCROLL_SPEED_Y

Declaration
public double TEXT_SELECT_SCROLL_SPEED_Y
Field Value
Type Description
System.Double

Properties

AddAuthorToAnnotations

Gets or sets whether an author should be added. Will open the author dialog if none is entered yet.

Declaration
public bool AddAuthorToAnnotations { get; set; }
Property Value
Type Description
System.Boolean

AllowedLinkActions

Gets or sets what types of actions the tool will activate. Defaults to All

Declaration
public ToolManager.AllowedLinks AllowedLinkActions { get; set; }
Property Value
Type Description
ToolManager.AllowedLinks

AnnotationAuthorNameSettingsString

The name under which the tools store the author name in the ApplicationData.Current.RoamingSettings container.

Declaration
public static string AnnotationAuthorNameSettingsString { get; }
Property Value
Type Description
System.String

AuthorDialog

Create an instance of IAuthorDialog and set it here to overwrite the default the tools are using.

Declaration
public IAuthorDialog AuthorDialog { get; set; }
Property Value
Type Description
IAuthorDialog

CopyAnnotatedTextToNote

Gets or sets whether annotating text will autimatically copy the contents into the text markup's note.

Declaration
public bool CopyAnnotatedTextToNote { get; set; }
Property Value
Type Description
System.Boolean

CurrentTool

Gets the currently active tool.

Declaration
public Tool CurrentTool { get; }
Property Value
Type Description
Tool

DebugAnnotationAuthorHasBeenAskedSettingsString

Declaration
public static string DebugAnnotationAuthorHasBeenAskedSettingsString { get; }
Property Value
Type Description
System.String

DocumentName

Gets or sets the DocumentName as the user of the ToolManager wants it displayed. If null, the tools will use PDFDoc.GetFileName() Useful when a temp file with a generic name is used.

Declaration
public string DocumentName { get; set; }
Property Value
Type Description
System.String

EnablePopupMenuOnLongPress

Gets or sets whether or not the tools will show a popup menu when the user long presses with their finger. This will only happen while using the pan tool.

Declaration
public bool EnablePopupMenuOnLongPress { get; set; }
Property Value
Type Description
System.Boolean

HasSelectedText

True if there currently is text selected as a result of the Tools.

Declaration
public bool HasSelectedText { get; }
Property Value
Type Description
System.Boolean

InkSmoothingBehaviour

Gets or sets when ink should be smoothed when finished.

Declaration
public ToolManager.InkSmoothingOptions InkSmoothingBehaviour { get; set; }
Property Value
Type Description
ToolManager.InkSmoothingOptions

IsAnnotManagerEnabled

Check if AnnotManager is enabled

Declaration
public bool IsAnnotManagerEnabled { get; }
Property Value
Type Description
System.Boolean

IsEnabled

Gets or sets whether or not the ToolManager will react to events from the PDFViewCtrl.

Declaration
public bool IsEnabled { get; set; }
Property Value
Type Description
System.Boolean

IsOnPhone

Declaration
public bool IsOnPhone { get; }
Property Value
Type Description
System.Boolean

IsPopupMenuEnabled

Gets or sets whether or not the tools will use the popup menu. If set to false, it is up to users to modify the tools so that they can be used with, for example, the app bar. Defaults to true.

Declaration
public bool IsPopupMenuEnabled { get; set; }
Property Value
Type Description
System.Boolean

IsSignatureDialogFullScreen

Gets or Sets whether the Signature Dialog should be displayed on Full Screen or reduced size

Declaration
public bool IsSignatureDialogFullScreen { get; set; }
Property Value
Type Description
System.Boolean

IsSoundAnnotEnabled

Gets or Sets whether the Sound Annotation creation is enabled or not

Declaration
public bool IsSoundAnnotEnabled { get; set; }
Property Value
Type Description
System.Boolean

NavigationStack

Gets or sets the ToolManager navigation stack. If not null, the Tools will use the NavigationStack for navigation, like following links.

Declaration
public NavigationStack NavigationStack { get; set; }
Property Value
Type Description
NavigationStack

PageNumberIndicator

This is a small UI widget that displays a the current page number.

Declaration
public PageNumberIndicator PageNumberIndicator { get; }
Property Value
Type Description
PageNumberIndicator

PanToolTextSelectionMode

Set whether click and drag actions should select text or pan the view.

Declaration
public ToolManager.TextSelectionBehaviour PanToolTextSelectionMode { get; set; }
Property Value
Type Description
ToolManager.TextSelectionBehaviour

PopupAuthorDialogFirstTime

Gets or sets whether or not the author dialog should pop up the first time the user adds an annotations.

Declaration
public bool PopupAuthorDialogFirstTime { get; set; }
Property Value
Type Description
System.Boolean

PopupLimitingTarget

Gets or sets a FrameworkElement that will be used by the PDFViewCtrl tools as the acceptable area on which to target

Declaration
public FrameworkElement PopupLimitingTarget { get; set; }
Property Value
Type Description
Windows.UI.Xaml.FrameworkElement

ReadOnlyMode

Gets or sets whether read-only mode should be enabled. In read only mode, annotations cannot be added, edited, or deleted.

Declaration
public bool ReadOnlyMode { get; set; }
Property Value
Type Description
System.Boolean

SelectedAnnotation

Gets the currently selected annotation. If no annotation is selected, this is null.

Declaration
public IAnnot SelectedAnnotation { get; }
Property Value
Type Description
IAnnot

SelectedAnnotationPageNumber

Gets the page number of the currently selected annotation. If no annotation is selected, this number is 0.

Declaration
public int SelectedAnnotationPageNumber { get; }
Property Value
Type Description
System.Int32

ShowDefaultSignature

Gets or Sets Whether to allow displaying a default (previously saved) signature

Declaration
public bool ShowDefaultSignature { get; set; }
Property Value
Type Description
System.Boolean

StylusAsPen

Gets or sets whether the stylus should pan or ink as the default state

Declaration
public bool StylusAsPen { get; set; }
Property Value
Type Description
System.Boolean

TextMarkupAdobeHack

Gets or 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).

Declaration
public bool TextMarkupAdobeHack { get; set; }
Property Value
Type Description
System.Boolean

UndoRedoAction

Gets the UndoRedoManger. UndoRedoManger contains API for Undo / Redo operation.

Declaration
public IUndoRedoManager UndoRedoAction { get; }
Property Value
Type Description
IUndoRedoManager

UseSmallPageNumberIndicator

This tells the Tools to use a smaller page number indicator. If true, the page number indicator will be smaller and will only contain the current page number, but not the total number of pages.

Declaration
public bool UseSmallPageNumberIndicator { get; set; }
Property Value
Type Description
System.Boolean

Methods

ApplyRedaction(Boolean)

Apply redaction to all Redaction Annotations present in the document

Declaration
public void ApplyRedaction(bool overlayText)
Parameters
Type Name Description
System.Boolean overlayText

Turn on/off displaying text overlay

CloseOpenDialog(Boolean)

Closes any open dialog the Tools have open. User this to handle things like back buttons.

Declaration
public bool CloseOpenDialog(bool all = false)
Parameters
Type Name Description
System.Boolean all

Closes all open dialogs if true, otherwise only 1 (in case there are nested ones).

Returns
Type Description
System.Boolean

ClosePopup()

Declaration
public bool ClosePopup()
Returns
Type Description
System.Boolean

CreateDefaultTool()

Creates the default tool (the Pan tool).

Declaration
public void CreateDefaultTool()

CreateMagnifyingTool()

Declaration
public MagnifyingTool CreateMagnifyingTool()
Returns
Type Description
MagnifyingTool

CreateTool(ToolType, Tool)

Declaration
public Tool CreateTool(ToolType mode, Tool current_tool)
Parameters
Type Name Description
ToolType mode
Tool current_tool
Returns
Type Description
Tool

CreateTool(ToolType, Tool, Boolean)

Declaration
public Tool CreateTool(ToolType mode, Tool current_tool, bool toolIsPersistent)
Parameters
Type Name Description
ToolType mode
Tool current_tool
System.Boolean toolIsPersistent
Returns
Type Description
Tool

CreateTool(String)

Creates a new tool based on one of the strings from GetAnnotationCreationOptions()

Declaration
public void CreateTool(string title)
Parameters
Type Name Description
System.String title

CreateTool(String, Boolean)

Declaration
public void CreateTool(string title, bool toolIsPersistent)
Parameters
Type Name Description
System.String title
System.Boolean toolIsPersistent

DeleteAnnotation(PDFViewCtrl, IAnnot, Int32)

Delete the annotation passed if it exists

Declaration
public void DeleteAnnotation(PDFViewCtrl pdfViewCtrl, IAnnot selectedAnnotation, int pageNumber)
Parameters
Type Name Description
PDFViewCtrl pdfViewCtrl

the active PDF View Control

IAnnot selectedAnnotation

the currently selected annotation to be deleted

System.Int32 pageNumber

the page number that contains the selected annotation

Dispose()

Disposes the ToolManager. Always perform this when the ToolManager is not needed anymore. The ToolManager is subscribed to events on the PDFViewCtrl that prevent it from being reclaimed. Therefore it is very important to dispose the ToolManager, so that it can unsubscribe to these events.

Declaration
public void Dispose()

EnableAnnotManager(String)

Enables annotation manager for annotation syncing

Declaration
public void EnableAnnotManager(string userId)
Parameters
Type Name Description
System.String userId

Finalize()

Declaration
protected void Finalize()

GetAnnotationCreationOptions()

Gets the list of options that are normally displayed when the user taps on blank space in the PDFViewCtrl (i.e. no annotation or text).

Declaration
public IList<string> GetAnnotationCreationOptions()
Returns
Type Description
IList<System.String>

GetAnnotManager()

Get AnnotManager instance. Make sure to check if it is already enabled

Declaration
public AnnotManager GetAnnotManager()
Returns
Type Description
AnnotManager

AnnotManager instance

GetPDFViewCtrl()

Get the PDFViewCtrl which this ToolManager is attached to

Declaration
public PDFViewCtrl GetPDFViewCtrl()
Returns
Type Description
PDFViewCtrl

PDFViewCtrl instance

GetSelectedText()

Declaration
public string GetSelectedText()
Returns
Type Description
System.String

KeyDownHandler(Object, KeyRoutedEventArgs)

Declaration
public void KeyDownHandler(object sender, KeyRoutedEventArgs e)
Parameters
Type Name Description
System.Object sender
Windows.UI.Xaml.Input.KeyRoutedEventArgs e

KeyUpHandler(Object, KeyRoutedEventArgs)

Declaration
public void KeyUpHandler(object sender, KeyRoutedEventArgs e)
Parameters
Type Name Description
System.Object sender
Windows.UI.Xaml.Input.KeyRoutedEventArgs e

SelectAnnotation(IAnnot, Int32)

Select the annotation passed if it exists in the page number and displays the context menu NOTE: only works with IMarkup style of annotations

Declaration
public void SelectAnnotation(IAnnot annotation, int pageNumber)
Parameters
Type Name Description
IAnnot annotation

the annotation to be selected

System.Int32 pageNumber

the page number where the annotation lives

SelectAnnotationGroup(IAnnot, Int32)

Select all annotations part of the same group of annotation Note: the annotation must be part of a annotation group in order to select it

Declaration
public void SelectAnnotationGroup(IAnnot annotation, int pageNumber)
Parameters
Type Name Description
IAnnot annotation

The annotation part of a group

System.Int32 pageNumber

The page number where the annotation is located

SetUndoRedoManager(IUndoRedoManager)

Attach UndoRedoManager to the ToolManager

Declaration
public void SetUndoRedoManager(IUndoRedoManager undoRedoManager = null)
Parameters
Type Name Description
IUndoRedoManager undoRedoManager

IUndoRedoManager instance

UnselectAllAnnotations()

Makes the ToolManager unselect all annotations.

Declaration
public void UnselectAllAnnotations()

Events

AnnotationAdded

This event is fired when an annotation has been added to a document

Declaration
public event ToolManager.AnnotationModificationHandler AnnotationAdded
Event Type
Type Description
ToolManager.AnnotationModificationHandler

AnnotationEdited

This event is raised whenever an annotation on the current document has been edited

Declaration
public event ToolManager.AnnotationModificationHandler AnnotationEdited
Event Type
Type Description
ToolManager.AnnotationModificationHandler

AnnotationGroupAdded

This event is fired when an annotation group has been added to a document

Declaration
public event ToolManager.AnnotationGroupModificationHandler AnnotationGroupAdded
Event Type
Type Description
ToolManager.AnnotationGroupModificationHandler

AnnotationGroupEdited

This event is raised whenever an annotation group on the current document has been edited

Declaration
public event ToolManager.AnnotationGroupModificationHandler AnnotationGroupEdited
Event Type
Type Description
ToolManager.AnnotationGroupModificationHandler

AnnotationGroupPreEdited

This event is raised whenever an annotation group on the current document is about to be edited

Declaration
public event ToolManager.AnnotationGroupModificationHandler AnnotationGroupPreEdited
Event Type
Type Description
ToolManager.AnnotationGroupModificationHandler

AnnotationGroupPreRemoved

This event is raised just before an annotation group is deleted from the document. At this point, the annotation group is still part of the document.

Declaration
public event ToolManager.AnnotationGroupModificationHandler AnnotationGroupPreRemoved
Event Type
Type Description
ToolManager.AnnotationGroupModificationHandler

AnnotationGroupRemoved

This event is raised whenever an annotation group has been deleted from the document

Declaration
public event ToolManager.AnnotationGroupModificationHandler AnnotationGroupRemoved
Event Type
Type Description
ToolManager.AnnotationGroupModificationHandler

AnnotationPreRemoved

This event is raised just before an annotation is deleted from the document. At this point, the annotation is still part of the document.

Declaration
public event ToolManager.AnnotationModificationHandler AnnotationPreRemoved
Event Type
Type Description
ToolManager.AnnotationModificationHandler

AnnotationRemoved

This event is raised whenever an annotation has been deleted from the document

Declaration
public event ToolManager.AnnotationModificationHandler AnnotationRemoved
Event Type
Type Description
ToolManager.AnnotationModificationHandler

FileHasChanged

This event is raised when the tools perform a save-as option. This happens when the users signs a form. This event will provide the file the user chose to save the doc in, and should in the future be used by the app when the user wants to save the document.

Declaration
public event OnFileChanged FileHasChanged
Event Type
Type Description
OnFileChanged

NewToolCreated

This even is raised every time a new tool is created. The type of the new tools is passed as a parameter.

Declaration
public event NewToolCreatedDelegate NewToolCreated
Event Type
Type Description
NewToolCreatedDelegate

OnShowContextMenu

This event is raised before displaying the context menu.

Declaration
public event ToolManager.ShowingContextMenuHandler OnShowContextMenu
Event Type
Type Description
ToolManager.ShowingContextMenuHandler

OnShowPopupMenu

Declaration
public event ToolManager.ShowingPopupMenuHandler OnShowPopupMenu
Event Type
Type Description
ToolManager.ShowingPopupMenuHandler

OnSoundAnnotRequested

Event is raised when user selects sound annotation (Mic) on the Context Menu

Declaration
public event ToolManager.SoundAnnotCreateHandler OnSoundAnnotRequested
Event Type
Type Description
ToolManager.SoundAnnotCreateHandler

SelectionChanged

This event is raised when annotations are selected or deselected by the editing tools

Declaration
public event ToolManager.AnnotationModificationHandler SelectionChanged
Event Type
Type Description
ToolManager.AnnotationModificationHandler

SelectionGroupChanged

This event is raised when annotation group is selected or deselected by the editing tools

Declaration
public event ToolManager.AnnotationGroupModificationHandler SelectionGroupChanged
Event Type
Type Description
ToolManager.AnnotationGroupModificationHandler

ShouldHandleLinkAnnotation

Declaration
public event ToolManager.InterceptAnnotationHandler ShouldHandleLinkAnnotation
Event Type
Type Description
ToolManager.InterceptAnnotationHandler

SingleTap

This event is raised when the ToolManager receives tap events. Before the tools handle the event, BeforeTool is raised. Once a single tap is confirmed (i.e. not part of a double tap) SingleTapConfirmed is raised

Declaration
public event SingleTapDelegate SingleTap
Event Type
Type Description
SingleTapDelegate

TextToSpeechActivated

Declaration
public event ToolManager.TextToSpeechDelegate TextToSpeechActivated
Event Type
Type Description
ToolManager.TextToSpeechDelegate

UndoRedoStatusChanged

This event is raised every time undo and redo manager has made a change

Declaration
public event UndoRedoStatusChangedDelegate UndoRedoStatusChanged
Event Type
Type Description
UndoRedoStatusChangedDelegate
In This Article
Back to top Generated by DocFX