Changes

Jump to navigation Jump to search
1,499 bytes added ,  18:54, 7 September 2021
new
< [[Graphics]]

How to create barcodes from within ConTeXt (MkIV/LMTX)?

== Zint module ==

* Download `zint` from https://www.zint.org.uk (Windows, Linux) or install it with [https://brew.sh Homebrew] or [https://www.macports.org/install.php MacPorts] (MacOS).
* MkIV: The `zint` executable must be in your `PATH`.
* LMTX: Copy or symlink the zint library into `$TEXROOT/tex/texmf-$ARCH/bin/lib/luametatex/zint` (you must create that path); on Windows, this is `libzint.dll`, on Linux and MacOS `libzint.so` (on MacOS the actual file name is `libzint.dylib`, but LuaMetaTeX expects `.so`). Then run `mtxrun --generate` to update the file database.

<texcode>
\usemodule[zint]
\barcode[alternative=isbn, text=9783865419026, width=4cm]
\barcode[alternative=qr code, text={https://wiki.contextgarden.net}, width=3cm]
</texcode>

Zint can produce about 40 different code types (“alternatives“). Try the [https://www.zint.org.uk/manual/chapter/4 name] (but lowercase with spaces) or look into the {{src|libs-imp-zint.lua|source}}


== Barcodes module ==

The old module uses PStricks and is deprecated. ({{src|m-barcodes.mkiv|Source}})


== barcode.lua ==

In 2012, user topskip published a small LuaTeX library on [https://tex.stackexchange.com/questions/50707/how-to-generate-ean-barcodes-with-tikz-or-metapost#50751 Stack Exchange]. It can only create EAN codes.

<texcode>
\loadluafile[barcode]
\define[1]\luabarcode{\directlua{generate_barcode_lua("#1")}}

\luabarcode{9783865419026}
</texcode>

Navigation menu