ExBarcode (ex_barcode v0.1.0)

Copy Markdown View Source

Pure Elixir barcode encoding library.

Supports Code 128 (full ASCII). Returns bar patterns as lists of module widths suitable for any renderer (PDF, SVG, Canvas, etc.).

Standard encoding

{:ok, bars} = ExBarcode.encode("Hello-123")

Returns alternating bar/space module widths.

Shaped encoding (creative barcodes)

{:ok, result} = ExBarcode.encode_shaped("SPOT2NITE", shape: :rv)
result.bars          # positioned bars with individual heights
result.decorations   # solid shapes (wheels, windows, etc.)

Returns an ExBarcode.Shape.Result with normalized 0.0–1.0 coordinates. Any renderer scales to desired size.

Available shapes: :rv, :camper, :city, :wave, :diamond, :hill

Summary

Functions

available_shapes()

See ExBarcode.Shape.available_shapes/0.

encode(text)

See ExBarcode.Code128.encode/1.

encode!(text)

See ExBarcode.Code128.encode!/1.

encode_shaped(text, opts)

See ExBarcode.Shape.encode/2.

encode_shaped!(text, opts)

See ExBarcode.Shape.encode!/2.

total_modules(text)

See ExBarcode.Code128.total_modules/1.