summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/libs-imp-zint.mkxl
blob: 72ce8157efe689c0a9854752dcccd7e6f255a612 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
%D \module
%D   [       file=m-zint,
%D        version=2010.12.07,
%D          title=\CONTEXT\ Extra Modules,
%D       subtitle=Zint Barcode Generator,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D Using \type {zint} seems to be the easiest way to generate
%D (PDF417) barcodes so therefore we now have this module. There
%D are proper (also windows) binaries at:
%D
%D \starttyping
%D http://www.zint.org.uk
%D \stoptyping
%D
%D There is a bit more code than needed as we want to be able to
%D feed names.

\registerctxluafile{libs-imp-zint}{}

\unprotect

\definefont[usedzintfont][dejavusansmono at 10bp]

\unexpanded\def\barcode[#1]% [alternative=,text=]
  {\bgroup
   \usedzintfont
   \getdummyparameters
     [\c!alternative=,\c!text=,#1]%
   \scale
     [#1]%
     {\clf_zint
         code {\dummyparameter\c!alternative}
         text {\dummyparameter\c!text}
      \relax}
   \egroup}

\protect

\continueifinputfile{libs-imp-zint.mkxl}

\starttext

% \dorecurse{1000}{
    \startTEXpage
        \barcode[alternative=PDF417,text={Hans Hagen}]%
        \blank
        \barcode[alternative=PDF417,text={Ton Otten}]%
        \blank
        \barcode[alternative=ISBN,text=9789490688011]%
        \blank
        \barcode[alternative=isbn,text=9789490688011,width=3cm]%
    \stopTEXpage
% }

\stoptext