For the complete documentation index, see llms.txt. This page is also available as Markdown.

Set Tool mode

You can set the current tool using the UI components as well as programmatically.

Changing default tool mode in Xamarin.Android

This tutorial only applies to Xamarin.Android. See Xamarin.iOS equivalent here .

When setting up the ToolManager, the default Tool is the Pan Tool. To change the tool, use ToolManager.setTool(ToolManager.Tool) API.

For example, to switch to the Text Highlighting tool, do the following:

mToolManager.Tool = mToolManager.CreateTool(ToolManager.ToolMode.TextHighlight, mToolManager.Tool);
mToolManager.setTool(mToolManager.createTool(ToolMode.TEXT_HIGHLIGHT, mToolManager.getTool()));
mToolManager.tool = mToolManager.createTool(ToolMode.TEXT_HIGHLIGHT, mToolManager.tool)

To continuously using the same tool, do:

var tool = mToolManager.CreateTool(ToolManager.ToolMode.TextHighlight, mToolManager.Tool);
((Tool) tool).ForceSameNextToolMode = true;
mToolManager.Tool = tool;
Tool tool = mToolManager.createTool(ToolMode.TEXT_HIGHLIGHT, mToolManager.getTool())
((Tool) tool).setForceSameNextToolMode(true)
mToolManager.setTool(tool);
val tool = mToolManager.createTool(ToolMode.TEXT_HIGHLIGHT, mToolManager.tool)
(tool as Tool).isForceSameNextToolMode = true
mToolManager.tool = tool

Changing default tool mode in Xamarin.iOS

This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here .

Changing tools in Xamarin.iOS is identical to changing tools in iOS. See tutorial in iOS guides.

// change to free text tool
var newTool = mToolManager.ChangeTool(new Class(typeof(pdftron.PDF.Tools.PTFreeTextCreate)));
((pdftron.PDF.Tools.PTTool)newTool).BackToPanToolAfterUse = true;

Last updated

Was this helpful?