PaperForge.Flow (PaperForge v1.4.3)

Copy Markdown View Source

Builder for unified document layout blocks.

Summary

Functions

Adds a scan-ready Interleaved 2 of 5 numeric barcode.

Builds a composable table cell.

Adds a native vector chart from {label, value} pairs. Supports :bar, :line, :area, :scatter, :pie, and :donut through :chart_type.

Adds a multi-column text section with balanced sequential columns.

Adds a reusable document component registered with PaperForge.component/3.

Adds an automatically numbered endnotes section.

Adds a footnote reserved at the bottom of its flow page.

Adds a simple responsive grid. Cells accept strings or inline-run lists.

Adds a measured scientific expression from PaperForge.Math AST.

Adds a scan-ready QR code rendered as PDF vector modules.

Adds a page-aware internal cross-reference to a heading or named destination.

Adds a paragraph made of inline text runs.

Adds an SVG fragment rendered as native PDF vectors.

Adds an automatic table of contents for headings in this flow.

Types

t()

@type t() :: %PaperForge.Flow{blocks: [PaperForge.Layout.Block.t()]}

Functions

barcode(flow, data, options \\ [])

@spec barcode(t(), binary(), keyword()) :: t()

Adds a scan-ready Interleaved 2 of 5 numeric barcode.

cell(content, options \\ [])

@spec cell(
  term(),
  keyword()
) :: map()

Builds a composable table cell.

Content can be a scalar value, a layout block, or a list of layout blocks. Options include :colspan, :rowspan, :align, :valign, :borders, :fill_color, and :color.

chart(flow, series, options \\ [])

@spec chart(t(), [{binary(), number()}], keyword()) :: t()

Adds a native vector chart from {label, value} pairs. Supports :bar, :line, :area, :scatter, :pie, and :donut through :chart_type.

columns(flow, count, paragraphs, options \\ [])

@spec columns(t(), pos_integer(), [binary()], keyword()) :: t()

Adds a multi-column text section with balanced sequential columns.

component(flow, name, assigns \\ %{}, options \\ [])

@spec component(t(), atom(), map() | keyword(), keyword()) :: t()

Adds a reusable document component registered with PaperForge.component/3.

custom(flow, fun, options \\ [])

@spec custom(
  t(),
  (PaperForge.Page.t(), PaperForge.PageContext.t() -> PaperForge.Page.t()),
  keyword()
) :: t()

endnotes(flow, notes, options \\ [])

@spec endnotes(t(), [{pos_integer(), binary()}], keyword()) :: t()

Adds an automatically numbered endnotes section.

footnote(flow, text)

@spec footnote(t(), binary()) :: t()

footnote(flow, number, text)

@spec footnote(t(), pos_integer(), binary()) :: t()
@spec footnote(t(), binary(), keyword()) :: t()

footnote(flow, number, text, options)

@spec footnote(t(), pos_integer(), binary(), keyword()) :: t()

Adds a footnote reserved at the bottom of its flow page.

grid(flow, columns, cells, options \\ [])

@spec grid(t(), pos_integer(), [term()], keyword()) :: t()

Adds a simple responsive grid. Cells accept strings or inline-run lists.

The grid is intentionally flow-native: it calculates its own height and moves as a single block when necessary.

heading(flow, text, options \\ [])

@spec heading(t(), binary(), keyword()) :: t()

image(flow, source, options \\ [])

@spec image(t(), binary(), keyword()) :: t()

keep_together(flow, block)

@spec keep_together(t(), (t() -> t()) | PaperForge.Layout.Block.t()) :: t()

list(flow, items, options \\ [])

@spec list(t(), [term()], keyword()) :: t()

math(flow, ast, options \\ [])

@spec math(t(), PaperForge.Math.ast(), keyword()) :: t()

Adds a measured scientific expression from PaperForge.Math AST.

new()

@spec new() :: t()

page_break(flow)

@spec page_break(t()) :: t()

paragraph(flow, text, options \\ [])

@spec paragraph(t(), binary(), keyword()) :: t()

qr_code(flow, data, options \\ [])

@spec qr_code(t(), binary(), keyword()) :: t()

Adds a scan-ready QR code rendered as PDF vector modules.

reference(flow, destination, options \\ [])

@spec reference(t(), binary() | atom(), keyword()) :: t()

Adds a page-aware internal cross-reference to a heading or named destination.

rich_text(flow, runs, options \\ [])

@spec rich_text(t(), [binary() | {binary(), keyword()}], keyword()) :: t()

Adds a paragraph made of inline text runs.

Each run is either a string or a {text, options} tuple. Run options can override :font, :size, :color, :weight, :style, and :link.

section(flow, section_id, options, fun)

@spec section(t(), atom(), keyword(), (t() -> t())) :: t()

separator(flow, options \\ [])

@spec separator(
  t(),
  keyword()
) :: t()

spacer(flow, height, options \\ [])

@spec spacer(t(), number(), keyword()) :: t()

svg(flow, source, options \\ [])

@spec svg(t(), binary(), keyword()) :: t()

Adds an SVG fragment rendered as native PDF vectors.

The renderer supports paths, Bézier curves, groups, affine transforms, viewBox, clip paths, inherited presentation attributes, and the common geometric elements.

table(flow, columns, rows, options \\ [])

@spec table(t(), [term()], [[term()]], keyword()) :: t()

table_of_contents(flow, options \\ [])

@spec table_of_contents(
  t(),
  keyword()
) :: t()

Adds an automatic table of contents for headings in this flow.