NativeElixirPdfUtilities.Validators.OutlineValidator (native_elixir_pdf_utilities v0.18.0)

View Source

Validation and normalization for PDF document outlines.

The validator is the single source of truth for caller-provided outline trees and outline structures read from existing PDFs. Prepared items use one-based page numbers so writers can resolve them against their own page object allocation.

Summary

Types

A normalized outline item.

A supported PDF destination view.

Functions

Reads and normalizes the active outline tree from a shared PDF context.

Validates and normalizes a caller-provided outline tree.

Types

item()

@type item() :: %{
  title: String.t(),
  page: pos_integer() | nil,
  view: view(),
  open: boolean(),
  children: [item()]
}

A normalized outline item.

view()

@type view() ::
  :fit
  | :fit_b
  | {:fit_h, number() | nil}
  | {:fit_v, number() | nil}
  | {:fit_bh, number() | nil}
  | {:fit_bv, number() | nil}
  | {:fit_r, number(), number(), number(), number()}
  | {:xyz, number() | nil, number() | nil, number() | nil}

A supported PDF destination view.

Functions

extract(context)

Reads and normalizes the active outline tree from a shared PDF context.

A document without an outline returns an empty list.

normalize(input, page_count)

@spec normalize(term(), non_neg_integer()) ::
  {:ok, [item()]}
  | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}

Validates and normalizes a caller-provided outline tree.