View Source QRCodeEx (QRCodeEx v0.1.1)

Simple QR Code Generator written in Elixir with no other dependencies.

To generate the SVG QR code:

qr_code_content = "your_qr_code_content"

qr_code_content
|> QRCodeEx.encode()
|> QRCodeEx.svg()

Link to this section Summary

Functions

Encode the binary with custom pattern bits. Only supports version 5.

qr_code_content
|> QRCodeEx.encode()
|> QRCodeEx.png(color: <<255, 0, 255>>, width: 200)

You can specify the following attributes of the QR code

qr_code_content
|> QRCodeEx.encode()
|> QRCodeEx.render()
qr_code_content
|> QRCodeEx.encode()
|> QRCodeEx.svg(color: "#cc6600", shape: "circle", width: 300)

You can specify the following attributes of the QR code

Link to this section Types

Link to this type

error_correction_level()

View Source

Specs

error_correction_level() :: :l | :m | :q | :h

Link to this section Functions

Link to this function

encode(bin, error_correction_level \\ :l)

View Source

Specs

encode(binary(), error_correction_level()) :: QRCodeEx.Matrix.t()

Encode the binary.

Link to this function

encode(bin, error_correction_level, bits)

View Source

Specs

encode(binary(), error_correction_level(), bitstring()) :: QRCodeEx.Matrix.t()

Encode the binary with custom pattern bits. Only supports version 5.

Link to this function

png(matrix, options \\ [])

View Source
qr_code_content
|> QRCodeEx.encode()
|> QRCodeEx.png(color: <<255, 0, 255>>, width: 200)

You can specify the following attributes of the QR code:

  • color: In binary format. The default is <<0, 0, 0>>
  • background_color: In binary format or :transparent. The default is <<255, 255, 255>>
  • width: The width of the QR code in pixel. (the actual size may vary, due to the number of modules in the code)

By default, QR code size will be dynamically generated based on the input string.

qr_code_content
|> QRCodeEx.encode()
|> QRCodeEx.render()
Link to this function

svg(matrix, options \\ [])

View Source
qr_code_content
|> QRCodeEx.encode()
|> QRCodeEx.svg(color: "#cc6600", shape: "circle", width: 300)

You can specify the following attributes of the QR code:

  • background_color: In hexadecimal format or :transparent. The default is #FFF
  • color: In hexadecimal format. The default is #000
  • shape: Only square or circle. The default is square
  • width: The width of the QR code in pixel. Without the width attribute, the QR code size will be dynamically generated based on the input string.
  • viewbox: When set to true, the SVG element will specify its height and width using viewBox, instead of explicit height and width tags.

Default options are [color: "#000", shape: "square", background_color: "#FFF"].