# `PdfElixide.Document`
[🔗](https://github.com/r8/pdf_elixide/blob/v0.3.1/lib/pdf_elixide/document.ex#L1)

Read-only representation of a PDF document.

# `t`

```elixir
@type t() :: %PdfElixide.Document{
  ref: reference(),
  source_path: Path.t() | nil,
  version: {non_neg_integer(), non_neg_integer()}
}
```

# `extract_text`

```elixir
@spec extract_text(t(), non_neg_integer()) :: {:ok, binary()} | {:error, term()}
```

Extracts the text content of the page at the given zero-based index.

# `extract_text!`

```elixir
@spec extract_text!(t(), non_neg_integer()) :: binary()
```

Extracts the text content of the page at the given zero-based index,
raising an error if it fails.

# `from_binary`

```elixir
@spec from_binary(binary()) :: {:ok, t()} | {:error, term()}
```

Opens a PDF document from the given binary data.

# `from_binary!`

```elixir
@spec from_binary!(binary()) :: t()
```

Opens a PDF document from the given binary data, raising an error if it fails.

# `open`

```elixir
@spec open(Path.t()) :: {:ok, t()} | {:error, term()}
```

Opens a PDF document from the specified file path.

# `open!`

```elixir
@spec open!(Path.t()) :: t()
```

Opens a PDF document from the specified file path, raising an error if it fails.

# `page_count`

```elixir
@spec page_count(t()) :: {:ok, non_neg_integer()} | {:error, term()}
```

Returns the number of pages in the given PDF document.

# `page_count!`

```elixir
@spec page_count!(t()) :: non_neg_integer()
```

Returns the number of pages in the given PDF document, raising an error if it fails.

# `source_path`

```elixir
@spec source_path(t()) :: Path.t() | nil
```

Returns the file path from which the document was loaded, or `nil` if it was loaded from binary data.

# `version`

```elixir
@spec version(t()) :: {non_neg_integer(), non_neg_integer()}
```

Returns the PDF specification version of the given document as a `{major, minor}` tuple.

---

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