Data-driven certificate recipe for completion, compliance, and award certificates.
All region coordinates are derived from template geometry — zero hardcoded A4
numerics. The default orientation is landscape (classic diploma/award look).
Portrait is reachable by passing orientation: :portrait.
Branding is optional: an unbranded certificate renders fine with default
fonts and no logo. When data.brand is present, the font and image are
registered via Rendro.Document.register_embedded_font/3 and
Rendro.Document.register_image/3, mirroring BrandedInvoice.
Required data keys
:title— certificate title, e.g."Certificate of Completion":recipient— recipient name, e.g."Jane Smith":date— issue date (Date.t())
Optional data keys
:body— body statement text (default""):seal_line— signature / seal line (default""):brand—%{font_name: atom(), logo_name: atom()}for branded output
Border frame option
The border: option adds a decorative keyline frame to the certificate.
All frame geometry is derived from page dimensions and margins — zero
hardcoded numerics.
border: false(default) — no frame; output is byte-identical to prior outputborder: true— single near-ink keyline ({34, 34, 34}), geometry-derivedborder: %{...}— map with any subset of override keys::color—{r, g, b}integer tuple (0–255), default{34, 34, 34}:style—:single(default) or:double:inset— float in pt, default0.5 * min(margins):weight— line width in pt, defaultmax(1.0, short / 400):gap— gap between rules for:doublestyle, default0
Examples
iex> template = Rendro.Recipes.Certificate.page_template()
iex> template.width > template.height # landscape default
true
iex> data = %{title: "Certificate of Completion", recipient: "Jane Smith", date: ~D[2026-05-29]}
iex> doc = Rendro.Recipes.Certificate.document(data)
iex> doc.page_template
:certificate
Summary
Functions
Assembles and returns a fully composed %Rendro.Document{} ready for
Rendro.render/2.
Returns a %Rendro.PageTemplate{} with geometry derived from the page size
and orientation options. Default is A4 landscape.
Returns a list of %Rendro.Section{} structs for the certificate body.
Functions
@spec document( map(), keyword() ) :: Rendro.Document.t()
Assembles and returns a fully composed %Rendro.Document{} ready for
Rendro.render/2.
Options
All options from page_template/1 are supported. Additionally:
:page_number_opts— options forwarded toRendro.page_number/1(unused for single-page certificates; included for API consistency):border—false(default),true, or a border options map (see module docs)
Examples
iex> data = %{title: "Certificate of Completion", recipient: "Jane Smith", date: ~D[2026-05-29]}
iex> doc = Rendro.Recipes.Certificate.document(data)
iex> doc.page_template
:certificate
@spec page_template(keyword()) :: Rendro.PageTemplate.t()
Returns a %Rendro.PageTemplate{} with geometry derived from the page size
and orientation options. Default is A4 landscape.
Options
:page_size—:a4(default) or:us_letter, or{width, height}tuple:orientation—:landscape(default) or:portrait:margin_top/:margin_right/:margin_bottom/:margin_left— margin in pt (default 72):name— template name atom (default:certificate):border—false(default),true, or a border options map
Examples
iex> t = Rendro.Recipes.Certificate.page_template()
iex> t.width > t.height
true
iex> t = Rendro.Recipes.Certificate.page_template(orientation: :portrait)
iex> t.height > t.width
true
@spec sections( map(), keyword() ) :: [Rendro.Section.t()]
Returns a list of %Rendro.Section{} structs for the certificate body.
Examples
iex> data = %{title: "Certificate of Completion", recipient: "Jane Smith", date: ~D[2026-05-29]}
iex> sections = Rendro.Recipes.Certificate.sections(data)
iex> length(sections) > 0
true