SefazDanfe.QrCode (sefaz_danfe v0.1.0)

Copy Markdown View Source

A QR Code (ISO/IEC 18004, model 2) encoder for the DANFE NFC-e: byte mode, error correction level M (the level the NFC-e manual asks for), versions 1 to 14, the best of the eight masks.

encode/1 answers the symbol as the runs of dark modules of each row, which the layout draws as rectangles (the quiet zone is the layout's):

{:ok, %{size: 45, runs: [[row, column, length], ...]}}

A text that does not fit version 14 (362 bytes) is {:error, :too_long}.

Everything is a pure function of the text; the tables are those of the standard for level M.

Summary

Functions

The QR Code of text.

Types

symbol()

@type symbol() :: %{size: pos_integer(), runs: [[non_neg_integer()]]}

Functions

encode(text)

@spec encode(String.t()) :: {:ok, symbol()} | {:error, :too_long}

The QR Code of text.