> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/xamarin/annotation/disable-annot-create-edit.md).

# Disable annotation creation and editing

Learn how to disable annotation creation and editing permissions in Xamarin.Android viewer with this tutorial. Find out how to hide annotation tools and more. The Apryse Xamarin SDK streamlines secure

You can choose disable annotation creation and editing permissions

{% tabs %}
{% tab title="Android" %}

## Disable annotation creation and editing in Xamarin.Android viewer

{% hint style="info" %}
**This tutorial only applies to Xamarin.Android. See Xamarin.iOS equivalent here .**
{% endhint %}

The long-press [QuickMenu](/xamarin/ui-customization/quick-menu.md) and [AnnotationToolbar](/xamarin/annotation/annotation-toolbar.md#android) show a default set of annotation creation tools. Editing of existing annotations is enabled for all annotation types by default. Other actions that are not tied to annotation creation or editing, such as text selection, form filling, link following, and multimedia playing are enabled by default.

## Disable annotation creation

To hide annotation creation tool(s) from the quick menu and annotation toolbar, you can set it in a centralized place with either[`ToolManagerBuilder`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Config.ToolManagerBuilder.html) or [`ToolManager`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Tools.ToolManager.html) depending on the fit.

See annotation and tool mode mapping here: annotation and its creation tool.

The following example hides text highlight and arrow annotation creation tool from the quick menu and annotation toolbar:

To use in `ToolManagerBuilder`:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
ToolManagerBuilder.From().DisableToolMode(new ToolManager.ToolMode[] {
    ToolManager.ToolMode.ArrowCreate,
    ToolManager.ToolMode.TextHighlight
});
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
ToolManagerBuilder.from().disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.ARROW_CREATE,
    ToolManager.ToolMode.TEXT_HIGHLIGHT}
)
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
ToolManagerBuilder.from().disableToolMode(arrayOf(
    ToolManager.ToolMode.ARROW_CREATE,
    ToolManager.ToolMode.TEXT_HIGHLIGHT
))
```

{% endcode %}
{% endtab %}
{% endtabs %}

To use in `ToolManager`:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
mToolManager.DisableToolMode(new ToolManager.ToolMode[] {
    ToolManager.ToolMode.ArrowCreate,
    ToolManager.ToolMode.TextHighlight
});
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
mToolManager.disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.ARROW_CREATE,
    ToolManager.ToolMode.TEXT_HIGHLIGHT}
);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
mToolManager.disableToolMode(arrayOf(
    ToolManager.ToolMode.ARROW_CREATE,
    ToolManager.ToolMode.TEXT_HIGHLIGHT
))
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Disable annotation editing

To disable annotation editing for certain annotation type(s), you can set it in a centralized place with either `ToolManagerBuilder` or `ToolManager` depending on the fit.

The following example disables editing of ellipse and rectangle annotations:

To use in `ToolManagerBuilder`:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
ToolManagerBuilder.From().DisableAnnotEditing(new Java.Lang.Integer[]
{
    new Java.Lang.Integer((int)Annot.Type.e_Circle),
    new Java.Lang.Integer((int)Annot.Type.e_Square)
});
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
ToolManagerBuilder.from().disableAnnotEditing(new Integer[]{
    Annot.e_Circle,
    Annot.e_Square}
);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
ToolManagerBuilder.from().disableAnnotEditing(arrayOf(Annot.e_Circle, Annot.e_Square))
```

{% endcode %}
{% endtab %}
{% endtabs %}

To use in `ToolManager`:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
mToolManager.DisableAnnotEditing(new Java.Lang.Integer[]
{
    new Java.Lang.Integer((int)Annot.Type.e_Circle),
    new Java.Lang.Integer((int)Annot.Type.e_Square)
});
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
mToolManager.disableAnnotEditing(new Integer[]{
    Annot.e_Circle,
    Annot.e_Square}
);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
mToolManager.disableAnnotEditing(arrayOf(Annot.e_Circle, Annot.e_Square))
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Disable functionality

Functionality that is not directly tied to annotation creation or editing such as text selection, form filling, link following etc. can also be disabled. Each functionality is in the form of a `Tool`. Once a `Tool` is disabled, `ToolManager` will never switch to it. Instead, it will switch to the `Pan` tool. `Pan` tool cannot be disabled.

The following example disables form filling and link following:

To use in `ToolManagerBuilder`:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
ToolManagerBuilder.From().DisableToolMode(new ToolManager.ToolMode[] {
    ToolManager.ToolMode.LinkAction,
    ToolManager.ToolMode.FormFill
});
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
ToolManagerBuilder.from().disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.LINK_ACTION,
    ToolManager.ToolMode.FORM_FILL}
)
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
ToolManagerBuilder.from().disableToolMode(arrayOf(
    ToolManager.ToolMode.LINK_ACTION,
    ToolManager.ToolMode.FORM_FILL
))
```

{% endcode %}
{% endtab %}
{% endtabs %}

To use in `ToolManager`:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
mToolManager.DisableToolMode(new ToolManager.ToolMode[] {
    ToolManager.ToolMode.LinkAction,
    ToolManager.ToolMode.FormFill
});
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
mToolManager.disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.LINK_ACTION,
    ToolManager.ToolMode.FORM_FILL}
);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
mToolManager.disableToolMode(arrayOf(
    ToolManager.ToolMode.LINK_ACTION,
    ToolManager.ToolMode.FORM_FILL
))
```

{% endcode %}
{% endtab %}
{% endtabs %}

See annotation and tool mode mapping here: annotation and its creation tool.
{% endtab %}

{% tab title="iOS" %}

## Disable annotation creation and editing in Xamarin.iOS viewer

{% hint style="info" %}
**This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here .**
{% endhint %}

The long-press popup menu and [`AnnotationToolbar`](/xamarin/annotation/annotation-toolbar.md#ios) show a default set of annotation creation tools. Editing of existing annotations is enabled for all annotation types by default. Other actions that are not tied to annotation creation, like text selection, form filling, and link following, are enabled by default.

## Disable annotation tools

Annotation creation and editing can be disabled on the `PTToolManager` using the `PTAnnotationOptions` property for a particular annotation type, such as [`TextAnnotationOptions`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.Tools.PTToolManager.html#pdftron_PDF_Tools_PTToolManager_TextAnnotationOptions)

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
// Disable text highlight annotation creation and editing.
mToolManager.HighlightAnnotationPermission.CanCreate = false;
mToolManager.HighlightAnnotationPermission.CanEdit = false;
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
// Disable text highlight annotation creation and editing.
self.toolManager.highlightAnnotationOptions.canCreate = false
self.toolManager.highlightAnnotationOptions.canEdit = false
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
// Disable text highlight annotation creation and editing.
self.toolManager.highlightAnnotationOptions.canCreate = NO;
self.toolManager.highlightAnnotationOptions.canEdit = NO;
```

{% endcode %}
{% endtab %}
{% endtabs %}

It is also possible to disable annotation creation and editing based on the [`PTExtendedAnnotType`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.PTExtendedAnnotType.html) enum by accessing the `PTAnnotationOptions` for that type using the [`AnnotationOptionsForAnnotType`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.Tools.PTToolManager.html#pdftron_PDF_Tools_PTToolManager_AnnotationOptionsForAnnotType_pdftron_PDF_PTExtendedAnnotType_) method.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
// Disable text highlight annotation creation and editing.
mToolManager.AnnotationPermissionForAnnotType(pdftron.PDF.PTExtendedAnnotType.Highlight).CanCreate = false;
mToolManager.AnnotationPermissionForAnnotType(pdftron.PDF.PTExtendedAnnotType.Highlight).CanEdit = false;
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
// Disable text highlight annotation creation and editing.
toolManager.annotationOptions(for: .highlight)?.canCreate = false
toolManager.annotationOptions(for: .highlight)?.canEdit = false
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
// Disable text highlight annotation creation and editing.
[self.toolManager annotationOptionsForAnnotType:PTExtendedAnnotTypeHighlight].canCreate = NO;
[self.toolManager annotationOptionsForAnnotType:PTExtendedAnnotTypeHighlight].canEdit = NO;
```

{% endcode %}
{% endtab %}
{% endtabs %}

The [`PTExtendedAnnotType`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.PTExtendedAnnotType.html) enum extends the basic `PTAnnotType` to further distinguish annotations based on their properties (line and arrow, polygon and cloudy, etc.). The `extendedAnnotType` property can be used to get the type of a [`Annot`](https://sdk.apryse.com/api/xamarinios/pdfnet/api/pdftron.PDF.Annot.html).

## Disable functionality

Functionality that is not directly tied to annotations,like text selection, form filling, link following, and ink erasing, can be disabled on the `PTToolManager` via convenience properties, for example [`LinkFollowingEnabled`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.Tools.PTToolManager.html#pdftron_PDF_Tools_PTToolManager_LinkFollowingEnabled):

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
// Disable link following.
mToolManager.LinkFollowingEnabled = false;
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
// Disable link following.
self.toolManager.isLinkFollowingEnabled = false
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
// Disable link following.
self.toolManager.linkFollowingEnabled = NO;
```

{% endcode %}
{% endtab %}
{% endtabs %}

The code above disables link following for [link annotations](https://sdk.apryse.com/api/xamarinios/pdfnet/api/pdftron.PDF.Annots.Link.html) and text links detected by the `PDFViewCtrl` (the [`SetUrlExtraction`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.PTPDFViewCtrl.html#pdftron_PDF_PTPDFViewCtrl_SetUrlExtraction_System_Boolean_) method must be called on the PDFViewCtrl to enable text link detection).
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/xamarin/annotation/disable-annot-create-edit.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
