Barcoder (barcoder v0.1.0)
A production-ready Code 39 barcode generator without external dependencies.
Code 39 can encode numbers, uppercase letters, and some special characters. Each barcode is automatically wrapped with start/stop characters (*).
Summary
Functions
Generates a Code 39 barcode for the given input string.
Generates a Code 39 barcode, raising an exception on error.
Returns the list of valid characters that can be encoded.
Validates if the input string contains only supported characters.
Functions
Generates a Code 39 barcode for the given input string.
Parameters
input
: String to encode (numbers, uppercase letters, and some special characters)options
: Keyword list of options:format
- Output format (:ascii
or:svg
, default::ascii
):width
- Bar width multiplier for SVG (default: 2):height
- Bar height for SVG (default: 100):quiet_zone
- Width of quiet zones (default: 10)
Examples
iex> Barcoder.generate("HELLO")
{:ok, ascii_barcode_string}
iex> Barcoder.generate("HELLO", format: :svg)
{:ok, svg_string}
iex> Barcoder.generate("hello")
{:error, "Invalid character: 'h'. Only uppercase letters, numbers, and specific special characters are allowed."}
Generates a Code 39 barcode, raising an exception on error.
Examples
iex> Barcoder.generate!("HELLO")
ascii_barcode_string
Returns the list of valid characters that can be encoded.
Validates if the input string contains only supported characters.
Examples
iex> Barcoder.validate_input("HELLO123")
:ok
iex> Barcoder.validate_input("hello")
{:error, "Invalid character: 'h'. Only uppercase letters, numbers, and specific special characters are allowed."}