Kreuzberg.Page (kreuzberg v4.4.2)

Copy Markdown View Source

Structure representing a single page extracted from a multi-page document.

Matches the Rust PageContent struct.

Fields

  • :page_number - Page number (0-indexed in Rust)
  • :content - Text content extracted from this page
  • :tables - Tables found on this page
  • :images - Images found on this page
  • :hierarchy - Optional hierarchy information (heading levels and blocks)
  • :is_blank - Whether the page is blank (nil if unknown)

Examples

iex> page = %Kreuzberg.Page{
...>   page_number: 0,
...>   content: "Page 1 content here"
...> }
iex> page.page_number
0

Summary

Functions

Creates a Page struct from a map.

Converts a Page struct to a map.

Types

t()

@type t() :: %Kreuzberg.Page{
  content: String.t(),
  hierarchy: Kreuzberg.PageHierarchy.t() | nil,
  images: [Kreuzberg.Image.t()],
  is_blank: boolean() | nil,
  page_number: non_neg_integer(),
  tables: [Kreuzberg.Table.t()]
}

Functions

from_map(data)

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

Creates a Page struct from a map.

Converts nested table and image maps to their proper struct types.

Examples

iex> Kreuzberg.Page.from_map(%{"page_number" => 0, "content" => "text"})
%Kreuzberg.Page{page_number: 0, content: "text"}

to_map(page)

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

Converts a Page struct to a map.