> 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/android/annotation/show-hide-annot.md).

# Show and hide existing annotations in Android

Learn how to show or hide annotations on PDFViewCtrl with these simple steps. Hide specific annotations or all at once for a seamless viewing experience. The Apryse Android SDK streamlines secure docu

By default, [`PDFViewCtrl`](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/PDFViewCtrl.html) shows all annotations on PDF document. If you want to hide a particular annotation on `PDFViewCtrl`, or hide all annotations on `PDFViewCtrl`, you can hide annotations as follows:

## Show and hide one annotation

To show a hidden annotation in `PDFViewCtrl`, call [`showAnnotation(Annot)`](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/PDFViewCtrl.html#showAnnotation\(com.pdftron.pdf.Annot\)):

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

```java
public static void showAnnotation(PDFViewCtrl pdfViewCtrl, Annot annot, int annotPageNum) {
  pdfViewCtrl.showAnnotation(annot);
  pdfViewCtrl.update(annot, annotPageNum);
}
```

{% endcode %}
{% endtab %}

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

```kotlin
fun showAnnotation(pdfViewCtrl: PDFViewCtrl, annot: Annot, annotPageNum: Int) {
    pdfViewCtrl.showAnnotation(annot)
    pdfViewCtrl.update(annot, annotPageNum)
}
```

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

To hide an annotation in `PDFViewCtrl`, call [`hideAnnotation(Annot)`](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/PDFViewCtrl.html#hideAnnotation\(com.pdftron.pdf.Annot\)).

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

```java
public static void hideAnnotation(PDFViewCtrl pdfViewCtrl, Annot annot, int annotPageNum) {
  pdfViewCtrl.hideAnnotation(annot);
  pdfViewCtrl.update(annot, annotPageNum);
}
```

{% endcode %}
{% endtab %}

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

```kotlin
fun hideAnnotation(pdfViewCtrl: PDFViewCtrl, annot: Annot, annotPageNum: Int) {
    pdfViewCtrl.hideAnnotation(annot)
    pdfViewCtrl.update(annot, annotPageNum)
}
```

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

{% hint style="info" %}
After hide and show an annotation in `PDFViewCtrl`, You must call `update` to redraw the area covered with the given annotation.
{% endhint %}

## Show and hide all annotations

Alternatively, you can show/hide all annotations in `PDFViewCtrl` by calling `setDrawAnnotations(boolean)`. This method toggles the visibility of annotations and form fields.

For example, disabling all annotations and form fields from rendering:

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

```java
try {
    pdfViewCtrl.setDrawAnnotations(false);
    pdfViewCtrl.update(true);
} catch (PDFNetException e) {
    e.printStackTrace();
}
```

{% endcode %}
{% endtab %}

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

```kotlin
try {
    pdfViewCtrl?.setDrawAnnotations(false)
    pdfViewCtrl?.update(true)
} catch (e : PDFNetException) {
    e.printStackTrace()
}
```

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

{% hint style="info" %}
After toggling annotation and form fields visibility in `PDFViewCtrl`, You must call `update` to redraw the pdf content.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/android/annotation/show-hide-annot.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
