Graphics and media/Collections of tips and tricks/Create barcodes

Unofficial ConTeXt Wiki mirror

Last modified: 2025-01-18

< Graphics and media

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

Zint module

\usemodule[zint]
\barcode[alternative=isbnx, text=9783865419026, width=4cm]
\barcode[alternative=qrcode, text={https://wiki.contextgarden.net}, width=3cm]

Zint can produce about 40 different code types (“alternatives“). Try the name (but lowercase with spaces) or look into the source

Barcodes module

The old module uses PStricks and is deprecated. (Source)

barcode.lua

In 2012, Patrick published a small LuaTeX library on Stack Exchange. It can only create EAN codes, but it has no dependencies and doesn’t even use MetaPost.

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

\luabarcode{9783865419026}