Creates a simple SVG out of the bytes that QRCode creates.
Encodes a string, returns a string containing an SVG.
Accepts ecc (error correction) mode as parameter (defaults to 'M'), can be
- 'L': 7% lost data recovery
- 'M': 15%
- 'Q': 25% (doesn't always work)
- 'H': 30% (often fails)
svg = QrCodeSvg.encode("Hey")
"<svg... ><rect../></svg>"
Due to a some unpleasantries in the underlying QRCode module, longer strings do not work.
QrCodeSvg.encode("http://foo.bar.baz")
Will throw up :-/
If available in Hex, the package can be installed
by adding qr_code_svg
to your list of dependencies in mix.exs
:
def deps do
[
{:qr_code_svg, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/qr_code_svg.