Difference between revisions of "Barcodes"

From Wiki
Jump to navigation Jump to search
m (another sentence)
m (→‎Zint module: - update zint names, see manual: https://www.zint.org.uk/manual/chapter/4)
 
Line 15: Line 15:
 
<texcode>
 
<texcode>
 
\usemodule[zint]
 
\usemodule[zint]
\barcode[alternative=isbn, text=9783865419026, width=4cm]
+
\barcode[alternative=isbnx, text=9783865419026, width=4cm]
\barcode[alternative=qr code, text={https://wiki.contextgarden.net}, width=3cm]
+
\barcode[alternative=qrcode, text={https://wiki.contextgarden.net}, width=3cm]
 
</texcode>
 
</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}}
 
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 ==
 
== Barcodes module ==

Latest revision as of 14:00, 20 February 2022

< 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 Homebrew or MacPorts (MacOS).
  • MkIV: The zint executable must be in your PATH.
  • LMTX: LuaMetaTeX uses the library. On Windows, that’s libzint.dll, on Linux and MacOS libzint.so (on MacOS the actual file name is libzint.dylib, but LuaMetaTeX expects .so).
    • Find that file, it should be in /usr/local/lib (Linux, Homebrew) or /opt/local/lib (MacPorts).
    • Create the path $TEXROOT/tex/texmf-$ARCH/bin/lib/luametatex/zint.
    • Copy or symlink the library into it (on MacOS remember naming it libzint.so).
    • Run mtxrun --generate to update the file database.
\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}