NativeElixirPdfUtilities.HtmlToPdf.Style (native_elixir_pdf_utilities v0.6.0)

View Source

Style computation for the native HTML-to-PDF renderer.

This module applies defaults, inheritance, font resolution, and the CSS cascade for the supported text, box, list, link, table, page-break, flexbox, grid, image, and embedded-font styling subset. Unsupported properties or invalid values fail the render instead of being ignored.

Summary

Functions

Computes styles for a parsed HTML document tree.

Computes styles and returns detailed CSS/document diagnostics when validation fails.

Types

render_option()

styled_element()

@type styled_element() :: %{
  type: :element,
  tag: String.t(),
  style: map(),
  children: [text_node() | styled_element()]
}

styled_tree()

@type styled_tree() :: %{type: :document, children: [styled_element()]}

text_node()

@type text_node() :: %{type: :text, text: String.t(), style: map()}

Functions

compute(dom, opts \\ [])

@spec compute(term(), [render_option()]) ::
  {:ok, styled_tree()} | {:error, :invalid_document}

Computes styles for a parsed HTML document tree.

compute_detailed(dom, opts \\ [])

@spec compute_detailed(term(), [render_option()]) ::
  {:ok, styled_tree()} | {:error, {:invalid_css | :invalid_document, map()}}

Computes styles and returns detailed CSS/document diagnostics when validation fails.