Branded canonical invoice recipe using the Tiered Composition pattern.
Branding inputs are supplied through data.brand:
data = %{
id: "INV-001",
date: ~D[2026-01-15],
items: [],
brand: %{font_name: :brand_heading, logo_name: :company_logo}
}font_name and logo_name must be atoms. Missing or invalid branding data
raises ArgumentError instead of silently falling back to the unbranded
recipe.
Examples
iex> template = Rendro.Recipes.BrandedInvoice.page_template()
iex> template.name
:branded_invoice
iex> Enum.map(template.regions, & &1.name) |> Enum.sort()
[:body, :footer, :header, :logo]
iex> data = %{id: "INV-001", date: ~D[2026-01-15], items: [], brand: %{font_name: :brand_heading, logo_name: :company_logo}}
iex> sections = Rendro.Recipes.BrandedInvoice.sections(data)
iex> length(sections)
4
iex> Enum.map(sections, & &1.region) |> Enum.sort()
[:body, :footer, :header, :logo]
iex> data = %{id: "INV-001", date: ~D[2026-01-15], items: [], brand: %{font_name: :brand_heading, logo_name: :company_logo}}
iex> doc = Rendro.Recipes.BrandedInvoice.document(data)
iex> doc.page_template
:branded_invoice
iex> Map.has_key?(doc.font_registry.fonts, :brand_heading)
true
iex> Map.has_key?(doc.asset_registry.assets, :company_logo)
true
Summary
Functions
Assembles and returns a fully composed branded %Rendro.Document{}.
Returns a %Rendro.PageTemplate{} with four named regions:
:logo, :header, :body, and :footer.
Returns a list of %Rendro.Section{} structs mapping branded invoice content
to the :logo, :header, :body, and :footer regions.
Functions
@spec document( map(), keyword() ) :: Rendro.Document.t()
Assembles and returns a fully composed branded %Rendro.Document{}.
@spec page_template(keyword()) :: Rendro.PageTemplate.t()
Returns a %Rendro.PageTemplate{} with four named regions:
:logo, :header, :body, and :footer.
@spec sections( map(), keyword() ) :: [Rendro.Section.t()]
Returns a list of %Rendro.Section{} structs mapping branded invoice content
to the :logo, :header, :body, and :footer regions.