# `Kreuzberg.PdfAnnotation`
[🔗](https://github.com/kreuzberg-dev/kreuzberg/blob/main/lib/kreuzberg/pdf_annotation.ex#L1)

Structure representing a PDF annotation extracted from a document page.

Matches the Rust `PdfAnnotation` struct.

## Fields

  * `:annotation_type` - The type of annotation (e.g., "text", "highlight", "link", "stamp", "underline", "strike_out", "other")
  * `:content` - Text content of the annotation (e.g., comment text, link URL), or nil
  * `:page_number` - Page number where the annotation appears (1-indexed)
  * `:bounding_box` - Bounding box coordinates {x0, y0, x1, y1} if available, nil otherwise

## Examples

    iex> annotation = %Kreuzberg.PdfAnnotation{
    ...>   annotation_type: "highlight",
    ...>   content: "Important section",
    ...>   page_number: 3,
    ...>   bounding_box: %{"x0" => 72.0, "y0" => 200.0, "x1" => 540.0, "y1" => 220.0}
    ...> }
    iex> annotation.annotation_type
    "highlight"

# `t`

```elixir
@type t() :: %Kreuzberg.PdfAnnotation{
  annotation_type: String.t(),
  bounding_box: map() | nil,
  content: String.t() | nil,
  page_number: non_neg_integer()
}
```

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Creates a PdfAnnotation struct from a map.

## Examples

    iex> Kreuzberg.PdfAnnotation.from_map(%{
    ...>   "annotation_type" => "text",
    ...>   "content" => "A note",
    ...>   "page_number" => 1
    ...> })
    %Kreuzberg.PdfAnnotation{
      annotation_type: "text",
      content: "A note",
      page_number: 1,
      bounding_box: nil
    }

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts a PdfAnnotation struct to a map.

## Examples

    iex> annotation = %Kreuzberg.PdfAnnotation{
    ...>   annotation_type: "link",
    ...>   content: "https://example.com",
    ...>   page_number: 2
    ...> }
    iex> Kreuzberg.PdfAnnotation.to_map(annotation)
    %{
      "annotation_type" => "link",
      "content" => "https://example.com",
      "page_number" => 2,
      "bounding_box" => nil
    }

---

*Consult [api-reference.md](api-reference.md) for complete listing*
