Pdf.Component.PageHeader (ex_pdf_components v1.0.1)

Copy Markdown View Source

Automatic page header component for PDF documents.

Registers a header template that renders on every page using Pdf.on_page(:header, ...). Combine with Pdf.Component.Paginator for full header + footer support.

Examples

doc
|> Pdf.Component.PageHeader.apply(%{
  title: "Monthly Report",
  subtitle: "Generated by ExPDF",
  color: {0.1, 0.1, 0.1}
})

doc
|> Pdf.Component.PageHeader.apply(%{
  left: "Acme Corp",
  right: :date,
  line: true,
  line_color: {0.2, 0.5, 0.8}
})

Summary

Functions

Apply an automatic header to the document.

Functions

apply(doc, style \\ %{})

Apply an automatic header to the document.

This registers a header template — all subsequent pages will have the header rendered automatically.

Style options

  • :title — centered title text
  • :left — left-aligned text (overrides centered title)
  • :right — right-aligned text, or :date for auto date, or :page for page number
  • :subtitle — smaller text below title (only with :title)
  • :font — font name (default "Helvetica")
  • :font_size — text size (default 9)
  • :color — text color (default dark gray)
  • :margin_top — distance from page top (default 30)
  • :line — draw a horizontal line below header (default true)
  • :line_color — line color (default light gray)
  • :line_width — line stroke width (default 0.75)
  • :skip_first — skip header on first page (default false)