> 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/flatten-annotation.md).

# Flatten PDF annotations in Xamarin

Flatten annotations in a PDF document with ease using PDFNet capabilities. Learn about annotation flattening and how to merge annotations with page content effectively. Explore the benefits of flatten

To flatten annotations in a PDF document.

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

```csharp
PDFDoc doc = new PDFDoc(filename);

// flatten all annotations
doc.FlattenAnnotations();
```

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

[PDF interactive forms (AcroForms)](/xamarin/get-started/samples.md#interactiveforms) Full sample code which illustrates some basic PDFNet capabilities related to interactive forms (also known as AcroForms) and annotation flattening.

## About annotation flattening

Annotation or [form flattening](/xamarin/forms/flatten.md) refers to the operation that changes annotations (such as markup, widgets, 3D models, etc.) into a static area that is part of the PDF document, just like the other text and images in the document.

Using the `Annotation.Flatten(page)`, it is possible to merge individual annotations with the page content. Apryse SDK also allows you to flatten all forms in the document in a single function call, with `PDFDoc.FlattenAnnotations()`.

Widget annotations share a relationship with forms because the display of a form field is a widget annotation. The process of flattening annotations therefore can flatten forms as well. By flattening and merging existing annotation appearances with page content, the original annotations are deleted from the PDF pages.

Note that it is not possible to undo the flatten operation. An alternative approach to annotation or form flattening is to set the annotation to `e_read_only`. The `e_read_only` flag on the annotation enables this modification.


---

# 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/flatten-annotation.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.
