Hex.pm Docs License

Reusable PDF components and a declarative template builder for Elixir. Built on top of ex_pdf_core.

Part of the ExPDF umbrella.

Installation

def deps do
  [
    {:ex_pdf_components, "~> 1.0"}
  ]
end

Most users should depend on ex_pdf instead, which bundles core, components, and the reader.

Components

ComponentDescription
Pdf.BuilderDeclarative template engine with cursor layout and auto-pagination
Pdf.StyledTableData tables with headers, styles, and column config
Pdf.Component.AlertAlert/notification boxes
Pdf.Component.AvatarCircular/rounded image avatars
Pdf.Component.BadgeInline text badges
Pdf.Component.BarcodeCode 128 barcodes (via ex_barcode)
Pdf.Component.BlockquoteStyled quotation blocks
Pdf.Component.CardContainer with shadow, border, background
Pdf.Component.ChartBasic chart rendering
Pdf.Component.ChipTag/chip labels
Pdf.Component.CodeBlockMonospaced code blocks
Pdf.Component.DividerHorizontal rule / separator
Pdf.Component.FootnotePage footnotes
Pdf.Component.KeyValueLabel–value pair lists
Pdf.Component.ListOrdered/unordered lists
Pdf.Component.MetricKPI / metric display
Pdf.Component.PageHeaderPage header with title and subtitle
Pdf.Component.PaginatorPage number footer
Pdf.Component.ProgressProgress bar
Pdf.Component.QrCodeQR codes (via ex_qr)
Pdf.Component.RatingStar ratings
Pdf.Component.SignatureSignature block
Pdf.Component.StatCardStatistics card
Pdf.Component.StepIndicatorStep/wizard indicator
Pdf.Component.TimelineTimeline visualization
Pdf.Component.TocTable of contents

Builder example

template = [
  %{type: :row, props: %{
    children: [
      {3, [%{type: :text, props: %{content: "Title", style: %{position: {0, -16}}}}]},
      {1, [%{type: :text, props: %{content: "Brand", style: %{position: {0, -16}}}}]}
    ],
    style: %{position: :cursor, size: {:full, 30}}
  }},
  %{type: :spacer, props: %{amount: 10}}
]

Pdf.Builder.render(template, config)

The Builder supports cursor-based layout with automatic pagination — when content overflows the page, page breaks are inserted automatically.

License

MIT. See LICENSE.md.