mirror of
https://git.code.sf.net/p/zint/code
synced 2026-05-13 01:23:50 +00:00
general: raw_segs -> content_segs, BARCODE_RAW_TEXT ->
`BARCODE_CONTENT_SEGS`, `z_rt_XXX()` -> `z_ct_XXX()`; move `encoded_data`/`row_height` to end of `zint_symbol` (see ZXing-C++ issue #883) manual: update re `content_segs`; `my_symbol` -> `symbol`; improve MicroPDF417 description
This commit is contained in:
14
docs/README
14
docs/README
@@ -1,11 +1,11 @@
|
||||
% docs/README 2025-10-08
|
||||
% docs/README 2025-11-04
|
||||
|
||||
For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" using pandoc 3.8.2.
|
||||
For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" using pandoc >= 3.8.2.
|
||||
|
||||
On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04)
|
||||
|
||||
wget https://github.com/jgm/pandoc/releases/download/3.8.2/pandoc-3.8.2-1-amd64.deb
|
||||
sudo dpkg -i pandoc-3.8.2-1-amd64.deb
|
||||
wget https://github.com/jgm/pandoc/releases/download/3.8.2.1/pandoc-3.8.2.1-1-amd64.deb
|
||||
sudo dpkg -i pandoc-3.8.2.1-1-amd64.deb
|
||||
sudo apt install librsvg2-bin
|
||||
sudo apt install texlive-xetex
|
||||
sudo apt install texlive-lang-cjk
|
||||
@@ -14,9 +14,9 @@ On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04)
|
||||
|
||||
On Fedora (tested on Fedora Linux 38 (Workstation Edition) and Fedora Linux 42 (Workstation Edition))
|
||||
|
||||
wget https://github.com/jgm/pandoc/releases/download/3.8.2/pandoc-3.8.2-linux-amd64.tar.gz
|
||||
tar xf pandoc-3.8.2-linux-amd64.tar.gz
|
||||
sudo mv -i pandoc-3.8.2/bin/pandoc /usr/local/bin
|
||||
wget https://github.com/jgm/pandoc/releases/download/3.8.2.1/pandoc-3.8.2.1-linux-amd64.tar.gz
|
||||
tar xf pandoc-3.8.2.1-linux-amd64.tar.gz
|
||||
sudo mv -i pandoc-3.8.2.1/bin/pandoc /usr/local/bin
|
||||
sudo dnf install librsvg2-tools.x86_64
|
||||
sudo dnf install texlive-xetex
|
||||
sudo dnf install texlive-ctex.noarch
|
||||
|
||||
263
docs/manual.html
263
docs/manual.html
@@ -334,7 +334,7 @@
|
||||
<h1 class="title">Zint Barcode Generator and Zint Barcode Studio User
|
||||
Manual</h1>
|
||||
<p class="author">Version 2.15.0.9</p>
|
||||
<p class="date">October 2025</p>
|
||||
<p class="date">November 2025</p>
|
||||
</header>
|
||||
<nav id="TOC" role="doc-toc">
|
||||
<ul>
|
||||
@@ -3080,7 +3080,8 @@ Data Matrix, DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR
|
||||
Code and Ultracode.</p>
|
||||
<p>The <code>--structapp</code> option marks a symbol as part of a
|
||||
Structured Append sequence, and has the format</p>
|
||||
<pre><code>--structapp=I,C[,ID]</code></pre>
|
||||
<div class="sourceCode" id="cb52"><pre
|
||||
class="sourceCode bash"><code class="sourceCode bash"><span id="cb52-1"><a href="#cb52-1" aria-hidden="true" tabindex="-1"></a><span class="ex">--structapp=I,C[,ID]</span></span></code></pre></div>
|
||||
<figure>
|
||||
<img src="images/datamatrix_structapp.svg" class="i2d"
|
||||
alt="zint -b DATAMATRIX -d "2nd of 3" --structapp="2,3,5006"" />
|
||||
@@ -3140,11 +3141,11 @@ creates and then deletes a symbol:</p>
|
||||
<span id="cb53-2"><a href="#cb53-2" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><stdio.h></span></span>
|
||||
<span id="cb53-3"><a href="#cb53-3" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
|
||||
<span id="cb53-4"><a href="#cb53-4" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
|
||||
<span id="cb53-5"><a href="#cb53-5" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>my_symbol<span class="op">;</span></span>
|
||||
<span id="cb53-6"><a href="#cb53-6" aria-hidden="true" tabindex="-1"></a> my_symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb53-7"><a href="#cb53-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>my_symbol <span class="op">!=</span> NULL<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb53-5"><a href="#cb53-5" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>symbol<span class="op">;</span></span>
|
||||
<span id="cb53-6"><a href="#cb53-6" aria-hidden="true" tabindex="-1"></a> symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb53-7"><a href="#cb53-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>symbol <span class="op">!=</span> NULL<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb53-8"><a href="#cb53-8" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">"Symbol successfully created!</span><span class="sc">\n</span><span class="st">"</span><span class="op">);</span></span>
|
||||
<span id="cb53-9"><a href="#cb53-9" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>my_symbol<span class="op">);</span></span>
|
||||
<span id="cb53-9"><a href="#cb53-9" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>symbol<span class="op">);</span></span>
|
||||
<span id="cb53-10"><a href="#cb53-10" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
||||
<span id="cb53-11"><a href="#cb53-11" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb53-12"><a href="#cb53-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
@@ -3164,11 +3165,11 @@ current working directory:</p>
|
||||
<div class="sourceCode" id="cb55"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb55-1"><a href="#cb55-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><zint.h></span></span>
|
||||
<span id="cb55-2"><a href="#cb55-2" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">(</span><span class="dt">int</span> argc<span class="op">,</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">)</span></span>
|
||||
<span id="cb55-3"><a href="#cb55-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
|
||||
<span id="cb55-4"><a href="#cb55-4" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>my_symbol<span class="op">;</span></span>
|
||||
<span id="cb55-5"><a href="#cb55-5" aria-hidden="true" tabindex="-1"></a> my_symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb55-6"><a href="#cb55-6" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode<span class="op">(</span>my_symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb55-7"><a href="#cb55-7" aria-hidden="true" tabindex="-1"></a> ZBarcode_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb55-8"><a href="#cb55-8" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>my_symbol<span class="op">);</span></span>
|
||||
<span id="cb55-4"><a href="#cb55-4" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>symbol<span class="op">;</span></span>
|
||||
<span id="cb55-5"><a href="#cb55-5" aria-hidden="true" tabindex="-1"></a> symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb55-6"><a href="#cb55-6" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode<span class="op">(</span>symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb55-7"><a href="#cb55-7" aria-hidden="true" tabindex="-1"></a> ZBarcode_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb55-8"><a href="#cb55-8" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>symbol<span class="op">);</span></span>
|
||||
<span id="cb55-9"><a href="#cb55-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb55-10"><a href="#cb55-10" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
<p>This can also be done in one stage using the
|
||||
@@ -3177,10 +3178,10 @@ example:</p>
|
||||
<div class="sourceCode" id="cb56"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb56-1"><a href="#cb56-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><zint.h></span></span>
|
||||
<span id="cb56-2"><a href="#cb56-2" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">(</span><span class="dt">int</span> argc<span class="op">,</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">)</span></span>
|
||||
<span id="cb56-3"><a href="#cb56-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
|
||||
<span id="cb56-4"><a href="#cb56-4" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>my_symbol<span class="op">;</span></span>
|
||||
<span id="cb56-5"><a href="#cb56-5" aria-hidden="true" tabindex="-1"></a> my_symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb56-6"><a href="#cb56-6" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb56-7"><a href="#cb56-7" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>my_symbol<span class="op">);</span></span>
|
||||
<span id="cb56-4"><a href="#cb56-4" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>symbol<span class="op">;</span></span>
|
||||
<span id="cb56-5"><a href="#cb56-5" aria-hidden="true" tabindex="-1"></a> symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb56-6"><a href="#cb56-6" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb56-7"><a href="#cb56-7" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>symbol<span class="op">);</span></span>
|
||||
<span id="cb56-8"><a href="#cb56-8" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb56-9"><a href="#cb56-9" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
<p>Note that when using the API, the input data is assumed to be 8-bit
|
||||
@@ -3260,13 +3261,13 @@ RGB and RGBA pixel on the screen implemented by the client
|
||||
application:</p>
|
||||
<div class="sourceCode" id="cb59"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb59-1"><a href="#cb59-1" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> row<span class="op">,</span> col<span class="op">,</span> i <span class="op">=</span> <span class="dv">0</span><span class="op">,</span> j <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb59-2"><a href="#cb59-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb59-3"><a href="#cb59-3" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>row <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> row <span class="op"><</span> my_symbol<span class="op">-></span>bitmap_height<span class="op">;</span> row<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb59-4"><a href="#cb59-4" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(</span>col <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> col <span class="op"><</span> my_symbol<span class="op">-></span>bitmap_width<span class="op">;</span> col<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb59-5"><a href="#cb59-5" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> red <span class="op">=</span> <span class="op">(</span><span class="dt">int</span><span class="op">)</span> my_symbol<span class="op">-></span>bitmap<span class="op">[</span>i<span class="op">];</span></span>
|
||||
<span id="cb59-6"><a href="#cb59-6" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> green <span class="op">=</span> <span class="op">(</span><span class="dt">int</span><span class="op">)</span> my_symbol<span class="op">-></span>bitmap<span class="op">[</span>i <span class="op">+</span> <span class="dv">1</span><span class="op">];</span></span>
|
||||
<span id="cb59-7"><a href="#cb59-7" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> blue <span class="op">=</span> <span class="op">(</span><span class="dt">int</span><span class="op">)</span> my_symbol<span class="op">-></span>bitmap<span class="op">[</span>i <span class="op">+</span> <span class="dv">2</span><span class="op">];</span></span>
|
||||
<span id="cb59-8"><a href="#cb59-8" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>my_symbol<span class="op">-></span>alphamap<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb59-9"><a href="#cb59-9" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> alpha <span class="op">=</span> <span class="op">(</span><span class="dt">int</span><span class="op">)</span> my_symbol<span class="op">-></span>alphamap<span class="op">[</span>j<span class="op">];</span></span>
|
||||
<span id="cb59-3"><a href="#cb59-3" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>row <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> row <span class="op"><</span> symbol<span class="op">-></span>bitmap_height<span class="op">;</span> row<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb59-4"><a href="#cb59-4" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(</span>col <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> col <span class="op"><</span> symbol<span class="op">-></span>bitmap_width<span class="op">;</span> col<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb59-5"><a href="#cb59-5" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> red <span class="op">=</span> <span class="op">(</span><span class="dt">int</span><span class="op">)</span> symbol<span class="op">-></span>bitmap<span class="op">[</span>i<span class="op">];</span></span>
|
||||
<span id="cb59-6"><a href="#cb59-6" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> green <span class="op">=</span> <span class="op">(</span><span class="dt">int</span><span class="op">)</span> symbol<span class="op">-></span>bitmap<span class="op">[</span>i <span class="op">+</span> <span class="dv">1</span><span class="op">];</span></span>
|
||||
<span id="cb59-7"><a href="#cb59-7" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> blue <span class="op">=</span> <span class="op">(</span><span class="dt">int</span><span class="op">)</span> symbol<span class="op">-></span>bitmap<span class="op">[</span>i <span class="op">+</span> <span class="dv">2</span><span class="op">];</span></span>
|
||||
<span id="cb59-8"><a href="#cb59-8" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>symbol<span class="op">-></span>alphamap<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb59-9"><a href="#cb59-9" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> alpha <span class="op">=</span> <span class="op">(</span><span class="dt">int</span><span class="op">)</span> symbol<span class="op">-></span>alphamap<span class="op">[</span>j<span class="op">];</span></span>
|
||||
<span id="cb59-10"><a href="#cb59-10" aria-hidden="true" tabindex="-1"></a> render_rgba<span class="op">(</span>row<span class="op">,</span> col<span class="op">,</span> red<span class="op">,</span> green<span class="op">,</span> blue<span class="op">,</span> alpha<span class="op">);</span></span>
|
||||
<span id="cb59-11"><a href="#cb59-11" aria-hidden="true" tabindex="-1"></a> j<span class="op">++;</span></span>
|
||||
<span id="cb59-12"><a href="#cb59-12" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span> <span class="cf">else</span> <span class="op">{</span></span>
|
||||
@@ -3288,9 +3289,9 @@ for blue, <code>'M'</code> for magenta, <code>'R'</code> for red,
|
||||
accessing the data is then:</p>
|
||||
<div class="sourceCode" id="cb60"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb60-1"><a href="#cb60-1" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> row<span class="op">,</span> col<span class="op">,</span> i <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb60-2"><a href="#cb60-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb60-3"><a href="#cb60-3" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>row <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> row <span class="op"><</span> my_symbol<span class="op">-></span>bitmap_height<span class="op">;</span> row<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb60-4"><a href="#cb60-4" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(</span>col <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> col <span class="op"><</span> my_symbol<span class="op">-></span>bitmap_width<span class="op">;</span> col<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb60-5"><a href="#cb60-5" aria-hidden="true" tabindex="-1"></a> render_pixel<span class="op">(</span>row<span class="op">,</span> col<span class="op">,</span> my_symbol<span class="op">-></span>bitmap<span class="op">[</span>i<span class="op">]);</span></span>
|
||||
<span id="cb60-3"><a href="#cb60-3" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>row <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> row <span class="op"><</span> symbol<span class="op">-></span>bitmap_height<span class="op">;</span> row<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb60-4"><a href="#cb60-4" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(</span>col <span class="op">=</span> <span class="dv">0</span><span class="op">;</span> col <span class="op"><</span> symbol<span class="op">-></span>bitmap_width<span class="op">;</span> col<span class="op">++)</span> <span class="op">{</span></span>
|
||||
<span id="cb60-5"><a href="#cb60-5" aria-hidden="true" tabindex="-1"></a> render_pixel<span class="op">(</span>row<span class="op">,</span> col<span class="op">,</span> symbol<span class="op">-></span>bitmap<span class="op">[</span>i<span class="op">]);</span></span>
|
||||
<span id="cb60-6"><a href="#cb60-6" aria-hidden="true" tabindex="-1"></a> i<span class="op">++;</span></span>
|
||||
<span id="cb60-7"><a href="#cb60-7" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
||||
<span id="cb60-8"><a href="#cb60-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
@@ -3321,23 +3322,23 @@ available:</p>
|
||||
<span id="cb62-3"><a href="#cb62-3" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> zint_vector_string <span class="op">*</span>string<span class="op">;</span></span>
|
||||
<span id="cb62-4"><a href="#cb62-4" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> zint_vector_circle <span class="op">*</span>circle<span class="op">;</span></span>
|
||||
<span id="cb62-5"><a href="#cb62-5" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb62-6"><a href="#cb62-6" aria-hidden="true" tabindex="-1"></a>prepare_canvas<span class="op">(</span>my_symbol<span class="op">-></span>vector<span class="op">-></span>width<span class="op">,</span> my_symbol<span class="op">-></span>vector<span class="op">-></span>height<span class="op">,</span></span>
|
||||
<span id="cb62-7"><a href="#cb62-7" aria-hidden="true" tabindex="-1"></a> my_symbol<span class="op">-></span>scale<span class="op">,</span> my_symbol<span class="op">-></span>fgcolour<span class="op">,</span> my_symbol<span class="op">-></span>bgcolour<span class="op">,</span></span>
|
||||
<span id="cb62-6"><a href="#cb62-6" aria-hidden="true" tabindex="-1"></a>prepare_canvas<span class="op">(</span>symbol<span class="op">-></span>vector<span class="op">-></span>width<span class="op">,</span> symbol<span class="op">-></span>vector<span class="op">-></span>height<span class="op">,</span></span>
|
||||
<span id="cb62-7"><a href="#cb62-7" aria-hidden="true" tabindex="-1"></a> symbol<span class="op">-></span>scale<span class="op">,</span> symbol<span class="op">-></span>fgcolour<span class="op">,</span> symbol<span class="op">-></span>bgcolour<span class="op">,</span></span>
|
||||
<span id="cb62-8"><a href="#cb62-8" aria-hidden="true" tabindex="-1"></a> rotate_angle<span class="op">);</span></span>
|
||||
<span id="cb62-9"><a href="#cb62-9" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb62-10"><a href="#cb62-10" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>rect <span class="op">=</span> my_symbol<span class="op">-></span>vector<span class="op">-></span>rectangles<span class="op">;</span> rect<span class="op">;</span> rect <span class="op">=</span> rect<span class="op">-></span>next<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb62-10"><a href="#cb62-10" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>rect <span class="op">=</span> symbol<span class="op">-></span>vector<span class="op">-></span>rectangles<span class="op">;</span> rect<span class="op">;</span> rect <span class="op">=</span> rect<span class="op">-></span>next<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb62-11"><a href="#cb62-11" aria-hidden="true" tabindex="-1"></a> draw_rect<span class="op">(</span>rect<span class="op">-></span>x<span class="op">,</span> rect<span class="op">-></span>y<span class="op">,</span> rect<span class="op">-></span>width<span class="op">,</span> rect<span class="op">-></span>height<span class="op">,</span></span>
|
||||
<span id="cb62-12"><a href="#cb62-12" aria-hidden="true" tabindex="-1"></a> rect<span class="op">-></span>colour<span class="op">);</span></span>
|
||||
<span id="cb62-13"><a href="#cb62-13" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
|
||||
<span id="cb62-14"><a href="#cb62-14" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>hex <span class="op">=</span> my_symbol<span class="op">-></span>vector<span class="op">-></span>hexagons<span class="op">;</span> hex<span class="op">;</span> hex <span class="op">=</span> hex<span class="op">-></span>next<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb62-14"><a href="#cb62-14" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>hex <span class="op">=</span> symbol<span class="op">-></span>vector<span class="op">-></span>hexagons<span class="op">;</span> hex<span class="op">;</span> hex <span class="op">=</span> hex<span class="op">-></span>next<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb62-15"><a href="#cb62-15" aria-hidden="true" tabindex="-1"></a> draw_hexagon<span class="op">(</span>hex<span class="op">-></span>x<span class="op">,</span> hex<span class="op">-></span>y<span class="op">,</span> hex<span class="op">-></span>diameter<span class="op">,</span> hex<span class="op">-></span>rotation<span class="op">);</span></span>
|
||||
<span id="cb62-16"><a href="#cb62-16" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
|
||||
<span id="cb62-17"><a href="#cb62-17" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>string <span class="op">=</span> my_symbol<span class="op">-></span>vector<span class="op">-></span>strings<span class="op">;</span> string<span class="op">;</span> string <span class="op">=</span> string<span class="op">-></span>next<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb62-17"><a href="#cb62-17" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>string <span class="op">=</span> symbol<span class="op">-></span>vector<span class="op">-></span>strings<span class="op">;</span> string<span class="op">;</span> string <span class="op">=</span> string<span class="op">-></span>next<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb62-18"><a href="#cb62-18" aria-hidden="true" tabindex="-1"></a> draw_string<span class="op">(</span>string<span class="op">-></span>x<span class="op">,</span> string<span class="op">-></span>y<span class="op">,</span> string<span class="op">-></span>fsize<span class="op">,</span></span>
|
||||
<span id="cb62-19"><a href="#cb62-19" aria-hidden="true" tabindex="-1"></a> string<span class="op">-></span>rotation<span class="op">,</span> string<span class="op">-></span>halign<span class="op">,</span></span>
|
||||
<span id="cb62-20"><a href="#cb62-20" aria-hidden="true" tabindex="-1"></a> string<span class="op">-></span>text<span class="op">,</span> string<span class="op">-></span>length<span class="op">);</span></span>
|
||||
<span id="cb62-21"><a href="#cb62-21" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
|
||||
<span id="cb62-22"><a href="#cb62-22" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>circle <span class="op">=</span> my_symbol<span class="op">-></span>vector<span class="op">-></span>circles<span class="op">;</span> circle<span class="op">;</span> circle <span class="op">=</span> circle<span class="op">-></span>next<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb62-22"><a href="#cb62-22" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> <span class="op">(</span>circle <span class="op">=</span> symbol<span class="op">-></span>vector<span class="op">-></span>circles<span class="op">;</span> circle<span class="op">;</span> circle <span class="op">=</span> circle<span class="op">-></span>next<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb62-23"><a href="#cb62-23" aria-hidden="true" tabindex="-1"></a> draw_circle<span class="op">(</span>circle<span class="op">-></span>x<span class="op">,</span> circle<span class="op">-></span>y<span class="op">,</span> circle<span class="op">-></span>diameter<span class="op">,</span> circle<span class="op">-></span>width<span class="op">);</span></span>
|
||||
<span id="cb62-24"><a href="#cb62-24" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
<h2 id="buffering-symbols-in-memory-memfile">5.6 Buffering Symbols in
|
||||
@@ -3353,15 +3354,15 @@ member <code>memfile</code> instead of to the output file
|
||||
<span id="cb63-3"><a href="#cb63-3" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><string.h></span></span>
|
||||
<span id="cb63-4"><a href="#cb63-4" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">(</span><span class="dt">int</span> argc<span class="op">,</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">)</span></span>
|
||||
<span id="cb63-5"><a href="#cb63-5" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
|
||||
<span id="cb63-6"><a href="#cb63-6" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>my_symbol<span class="op">;</span></span>
|
||||
<span id="cb63-7"><a href="#cb63-7" aria-hidden="true" tabindex="-1"></a> my_symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb63-8"><a href="#cb63-8" aria-hidden="true" tabindex="-1"></a> my_symbol<span class="op">-></span>output_options <span class="op">|=</span> BARCODE_MEMORY_FILE<span class="op">;</span></span>
|
||||
<span id="cb63-6"><a href="#cb63-6" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>symbol<span class="op">;</span></span>
|
||||
<span id="cb63-7"><a href="#cb63-7" aria-hidden="true" tabindex="-1"></a> symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb63-8"><a href="#cb63-8" aria-hidden="true" tabindex="-1"></a> symbol<span class="op">-></span>output_options <span class="op">|=</span> BARCODE_MEMORY_FILE<span class="op">;</span></span>
|
||||
<span id="cb63-9"><a href="#cb63-9" aria-hidden="true" tabindex="-1"></a> <span class="co">/* Only the extension is used, to determine output format */</span></span>
|
||||
<span id="cb63-10"><a href="#cb63-10" aria-hidden="true" tabindex="-1"></a> strcpy<span class="op">(</span>my_symbol<span class="op">-></span>outfile<span class="op">,</span> <span class="st">"mem.svg"</span><span class="op">);</span></span>
|
||||
<span id="cb63-11"><a href="#cb63-11" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb63-12"><a href="#cb63-12" aria-hidden="true" tabindex="-1"></a> <span class="co">/* `my_symbol->memfile` now contains the SVG output */</span></span>
|
||||
<span id="cb63-13"><a href="#cb63-13" aria-hidden="true" tabindex="-1"></a> fwrite<span class="op">(</span>my_symbol<span class="op">-></span>memfile<span class="op">,</span> <span class="dv">1</span><span class="op">,</span> my_symbol<span class="op">-></span>memfile_size<span class="op">,</span> stdout<span class="op">);</span></span>
|
||||
<span id="cb63-14"><a href="#cb63-14" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>my_symbol<span class="op">);</span></span>
|
||||
<span id="cb63-10"><a href="#cb63-10" aria-hidden="true" tabindex="-1"></a> strcpy<span class="op">(</span>symbol<span class="op">-></span>outfile<span class="op">,</span> <span class="st">"mem.svg"</span><span class="op">);</span></span>
|
||||
<span id="cb63-11"><a href="#cb63-11" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb63-12"><a href="#cb63-12" aria-hidden="true" tabindex="-1"></a> <span class="co">/* `symbol->memfile` now contains the SVG output */</span></span>
|
||||
<span id="cb63-13"><a href="#cb63-13" aria-hidden="true" tabindex="-1"></a> fwrite<span class="op">(</span>symbol<span class="op">-></span>memfile<span class="op">,</span> <span class="dv">1</span><span class="op">,</span> symbol<span class="op">-></span>memfile_size<span class="op">,</span> stdout<span class="op">);</span></span>
|
||||
<span id="cb63-14"><a href="#cb63-14" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>symbol<span class="op">);</span></span>
|
||||
<span id="cb63-15"><a href="#cb63-15" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb63-16"><a href="#cb63-16" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
<p>will print the SVG output to <code>stdout</code> (the file
|
||||
@@ -3606,18 +3607,6 @@ with a terminating <code>NUL</code>.</td>
|
||||
<td style="text-align: left;">(output only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left;"><code>encoded_data</code></td>
|
||||
<td style="text-align: left;">array of unsigned character arrays</td>
|
||||
<td style="text-align: left;">Representation of the encoded data.</td>
|
||||
<td style="text-align: left;">(output only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left;"><code>row_height</code></td>
|
||||
<td style="text-align: left;">array of floats</td>
|
||||
<td style="text-align: left;">Heights of each row.</td>
|
||||
<td style="text-align: left;">(output only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left;"><code>errtxt</code></td>
|
||||
<td style="text-align: left;">character string</td>
|
||||
<td style="text-align: left;">Error message in the event that an error
|
||||
@@ -3680,17 +3669,29 @@ in Memory (memfile)</a>.</td>
|
||||
<td style="text-align: left;">(output only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left;"><code>raw_segs</code></td>
|
||||
<td style="text-align: left;"><code>content_segs</code></td>
|
||||
<td style="text-align: left;">pointer to array of segments</td>
|
||||
<td style="text-align: left;">Pointer to array of raw segments if
|
||||
<code>BARCODE_RAW_TEXT</code> set in <code>output_options</code> - see
|
||||
<a href="#feedback">5.16 Feedback</a>.</td>
|
||||
<td style="text-align: left;">Pointer to array of content segments if
|
||||
<code>BARCODE_CONTENT_SEGS</code> set in <code>output_options</code> -
|
||||
see <a href="#feedback">5.16 Feedback</a>.</td>
|
||||
<td style="text-align: left;">(output only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left;"><code>raw_seg_count</code></td>
|
||||
<td style="text-align: left;"><code>content_seg_count</code></td>
|
||||
<td style="text-align: left;">integer</td>
|
||||
<td style="text-align: left;">Number of raw segments.</td>
|
||||
<td style="text-align: left;">Number of content segments.</td>
|
||||
<td style="text-align: left;">(output only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left;"><code>encoded_data</code></td>
|
||||
<td style="text-align: left;">array of unsigned character arrays</td>
|
||||
<td style="text-align: left;">Representation of the encoded data.</td>
|
||||
<td style="text-align: left;">(output only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left;"><code>row_height</code></td>
|
||||
<td style="text-align: left;">array of floats</td>
|
||||
<td style="text-align: left;">Heights of each row.</td>
|
||||
<td style="text-align: left;">(output only)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -3702,18 +3703,18 @@ now taller and plotted in green.</p>
|
||||
<span id="cb64-2"><a href="#cb64-2" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><string.h></span></span>
|
||||
<span id="cb64-3"><a href="#cb64-3" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">(</span><span class="dt">int</span> argc<span class="op">,</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">)</span></span>
|
||||
<span id="cb64-4"><a href="#cb64-4" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
|
||||
<span id="cb64-5"><a href="#cb64-5" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>my_symbol<span class="op">;</span></span>
|
||||
<span id="cb64-6"><a href="#cb64-6" aria-hidden="true" tabindex="-1"></a> my_symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb64-7"><a href="#cb64-7" aria-hidden="true" tabindex="-1"></a> strcpy<span class="op">(</span>my_symbol<span class="op">-></span>fgcolour<span class="op">,</span> <span class="st">"00ff00"</span><span class="op">);</span></span>
|
||||
<span id="cb64-8"><a href="#cb64-8" aria-hidden="true" tabindex="-1"></a> my_symbol<span class="op">-></span>height <span class="op">=</span> <span class="fl">400.0</span><span class="bu">f</span><span class="op">;</span></span>
|
||||
<span id="cb64-9"><a href="#cb64-9" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb64-10"><a href="#cb64-10" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>my_symbol<span class="op">);</span></span>
|
||||
<span id="cb64-5"><a href="#cb64-5" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>symbol<span class="op">;</span></span>
|
||||
<span id="cb64-6"><a href="#cb64-6" aria-hidden="true" tabindex="-1"></a> symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb64-7"><a href="#cb64-7" aria-hidden="true" tabindex="-1"></a> strcpy<span class="op">(</span>symbol<span class="op">-></span>fgcolour<span class="op">,</span> <span class="st">"00ff00"</span><span class="op">);</span></span>
|
||||
<span id="cb64-8"><a href="#cb64-8" aria-hidden="true" tabindex="-1"></a> symbol<span class="op">-></span>height <span class="op">=</span> <span class="fl">400.0</span><span class="bu">f</span><span class="op">;</span></span>
|
||||
<span id="cb64-9"><a href="#cb64-9" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb64-10"><a href="#cb64-10" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>symbol<span class="op">);</span></span>
|
||||
<span id="cb64-11"><a href="#cb64-11" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb64-12"><a href="#cb64-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
<p>Note that background removal for all outputs except BMP can be
|
||||
achieved by setting the background alpha to <code>"00"</code> where the
|
||||
values for R, G and B will be ignored:</p>
|
||||
<div class="sourceCode" id="cb65"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb65-1"><a href="#cb65-1" aria-hidden="true" tabindex="-1"></a> strcpy<span class="op">(</span>my_symbol<span class="op">-></span>bgcolour<span class="op">,</span> <span class="st">"55555500"</span><span class="op">);</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb65"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb65-1"><a href="#cb65-1" aria-hidden="true" tabindex="-1"></a> strcpy<span class="op">(</span>symbol<span class="op">-></span>bgcolour<span class="op">,</span> <span class="st">"55555500"</span><span class="op">);</span></span></code></pre></div>
|
||||
<p>This is what the CLI option <code>--nobackground</code> does - see <a
|
||||
href="#using-colour">4.7 Using Colour</a>.</p>
|
||||
<h2 id="handling-errors">5.8 Handling Errors</h2>
|
||||
@@ -3837,23 +3838,23 @@ below:</p>
|
||||
<span id="cb66-3"><a href="#cb66-3" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im"><string.h></span></span>
|
||||
<span id="cb66-4"><a href="#cb66-4" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">(</span><span class="dt">int</span> argc<span class="op">,</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">)</span></span>
|
||||
<span id="cb66-5"><a href="#cb66-5" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
|
||||
<span id="cb66-6"><a href="#cb66-6" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>my_symbol<span class="op">;</span></span>
|
||||
<span id="cb66-6"><a href="#cb66-6" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>symbol<span class="op">;</span></span>
|
||||
<span id="cb66-7"><a href="#cb66-7" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> error<span class="op">;</span></span>
|
||||
<span id="cb66-8"><a href="#cb66-8" aria-hidden="true" tabindex="-1"></a> my_symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb66-8"><a href="#cb66-8" aria-hidden="true" tabindex="-1"></a> symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb66-9"><a href="#cb66-9" aria-hidden="true" tabindex="-1"></a> <span class="co">/* Set invalid foreground colour */</span></span>
|
||||
<span id="cb66-10"><a href="#cb66-10" aria-hidden="true" tabindex="-1"></a> strcpy<span class="op">(</span>my_symbol<span class="op">-></span>fgcolour<span class="op">,</span> <span class="st">"nonsense"</span><span class="op">);</span></span>
|
||||
<span id="cb66-11"><a href="#cb66-11" aria-hidden="true" tabindex="-1"></a> error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb66-10"><a href="#cb66-10" aria-hidden="true" tabindex="-1"></a> strcpy<span class="op">(</span>symbol<span class="op">-></span>fgcolour<span class="op">,</span> <span class="st">"nonsense"</span><span class="op">);</span></span>
|
||||
<span id="cb66-11"><a href="#cb66-11" aria-hidden="true" tabindex="-1"></a> error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> argv<span class="op">[</span><span class="dv">1</span><span class="op">],</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb66-12"><a href="#cb66-12" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>error <span class="op">!=</span> <span class="dv">0</span><span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb66-13"><a href="#cb66-13" aria-hidden="true" tabindex="-1"></a> <span class="co">/* Some warning or error occurred */</span></span>
|
||||
<span id="cb66-14"><a href="#cb66-14" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">"</span><span class="sc">%s\n</span><span class="st">"</span><span class="op">,</span> my_symbol<span class="op">-></span>errtxt<span class="op">);</span></span>
|
||||
<span id="cb66-14"><a href="#cb66-14" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">"</span><span class="sc">%s\n</span><span class="st">"</span><span class="op">,</span> symbol<span class="op">-></span>errtxt<span class="op">);</span></span>
|
||||
<span id="cb66-15"><a href="#cb66-15" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>error <span class="op">>=</span> ZINT_ERROR<span class="op">)</span> <span class="op">{</span></span>
|
||||
<span id="cb66-16"><a href="#cb66-16" aria-hidden="true" tabindex="-1"></a> <span class="co">/* Stop now */</span></span>
|
||||
<span id="cb66-17"><a href="#cb66-17" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>my_symbol<span class="op">);</span></span>
|
||||
<span id="cb66-17"><a href="#cb66-17" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>symbol<span class="op">);</span></span>
|
||||
<span id="cb66-18"><a href="#cb66-18" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">1</span><span class="op">;</span></span>
|
||||
<span id="cb66-19"><a href="#cb66-19" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
||||
<span id="cb66-20"><a href="#cb66-20" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
||||
<span id="cb66-21"><a href="#cb66-21" aria-hidden="true" tabindex="-1"></a> <span class="co">/* Otherwise carry on with the rest of the application */</span></span>
|
||||
<span id="cb66-22"><a href="#cb66-22" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>my_symbol<span class="op">);</span></span>
|
||||
<span id="cb66-22"><a href="#cb66-22" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>symbol<span class="op">);</span></span>
|
||||
<span id="cb66-23"><a href="#cb66-23" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb66-24"><a href="#cb66-24" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
<p>This code will exit with the appropriate message:</p>
|
||||
@@ -3871,7 +3872,7 @@ example</p>
|
||||
aspects of the output file. To select more than one option from the
|
||||
table below simply <code>OR</code> them together when adjusting this
|
||||
value:</p>
|
||||
<div class="sourceCode" id="cb69"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb69-1"><a href="#cb69-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>output_options <span class="op">|=</span> BARCODE_BIND <span class="op">|</span> READER_INIT<span class="op">;</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb69"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb69-1"><a href="#cb69-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>output_options <span class="op">|=</span> BARCODE_BIND <span class="op">|</span> READER_INIT<span class="op">;</span></span></code></pre></div>
|
||||
<table id="tbl:api_output_options">
|
||||
<caption><span class="table-label">Table 14:</span> API
|
||||
<code>output_options</code> Values</caption>
|
||||
@@ -3982,10 +3983,10 @@ available for SVG output only.</td>
|
||||
file.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left;"><code>BARCODE_RAW_TEXT</code></td>
|
||||
<td style="text-align: left;">Write data encoded to raw segment buffers
|
||||
<code>symbol->raw_segs</code> (see <a href="#feedback">5.16
|
||||
Feedback</a>).</td>
|
||||
<td style="text-align: left;"><code>BARCODE_CONTENT_SEGS</code></td>
|
||||
<td style="text-align: left;">Write data encoded to content segment
|
||||
buffers <code>symbol->contentsegs</code> (see <a
|
||||
href="#feedback">5.16 Feedback</a>).</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -4077,11 +4078,11 @@ CLI and GUI, which is <code>UNICODE_MODE</code>.)</p>
|
||||
<code>FAST_MODE</code>, <code>EXTRA_ESCAPE_MODE</code> and
|
||||
<code>GS1SYNTAXENGINE_MODE</code> are optional. So, for example, you can
|
||||
set</p>
|
||||
<div class="sourceCode" id="cb70"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb70-1"><a href="#cb70-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>input_mode <span class="op">=</span> UNICODE_MODE <span class="op">|</span> ESCAPE_MODE<span class="op">;</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb70"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb70-1"><a href="#cb70-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>input_mode <span class="op">=</span> UNICODE_MODE <span class="op">|</span> ESCAPE_MODE<span class="op">;</span></span></code></pre></div>
|
||||
<p>or</p>
|
||||
<div class="sourceCode" id="cb71"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb71-1"><a href="#cb71-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>input_mode <span class="op">=</span> GS1_MODE <span class="op">|</span> GS1PARENS_MODE <span class="op">|</span> GS1NOCHECK_MODE<span class="op">;</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb71"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb71-1"><a href="#cb71-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>input_mode <span class="op">=</span> GS1_MODE <span class="op">|</span> GS1PARENS_MODE <span class="op">|</span> GS1NOCHECK_MODE<span class="op">;</span></span></code></pre></div>
|
||||
<p>whereas</p>
|
||||
<div class="sourceCode" id="cb72"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb72-1"><a href="#cb72-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>input_mode <span class="op">=</span> DATA_MODE <span class="op">|</span> GS1_MODE<span class="op">;</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb72"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb72-1"><a href="#cb72-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>input_mode <span class="op">=</span> DATA_MODE <span class="op">|</span> GS1_MODE<span class="op">;</span></span></code></pre></div>
|
||||
<p>is not valid.</p>
|
||||
<p>Permissible escape sequences (<code>ESCAPE_MODE</code>) are listed in
|
||||
<span class="cross-ref-group"><a href="#tbl:escape_sequences"
|
||||
@@ -4153,13 +4154,13 @@ Symbologies</a></span>). For example:</p>
|
||||
<span id="cb75-6"><a href="#cb75-6" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span> <span class="st">"Текст"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">7</span> <span class="op">},</span></span>
|
||||
<span id="cb75-7"><a href="#cb75-7" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span> <span class="st">"文章"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">20</span> <span class="op">}</span></span>
|
||||
<span id="cb75-8"><a href="#cb75-8" aria-hidden="true" tabindex="-1"></a> <span class="op">};</span></span>
|
||||
<span id="cb75-9"><a href="#cb75-9" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>my_symbol<span class="op">;</span></span>
|
||||
<span id="cb75-10"><a href="#cb75-10" aria-hidden="true" tabindex="-1"></a> my_symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb75-11"><a href="#cb75-11" aria-hidden="true" tabindex="-1"></a> my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_AZTEC<span class="op">;</span></span>
|
||||
<span id="cb75-12"><a href="#cb75-12" aria-hidden="true" tabindex="-1"></a> my_symbol<span class="op">-></span>input_mode <span class="op">=</span> UNICODE_MODE<span class="op">;</span></span>
|
||||
<span id="cb75-13"><a href="#cb75-13" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode_Segs<span class="op">(</span>my_symbol<span class="op">,</span> segs<span class="op">,</span> <span class="dv">3</span><span class="op">);</span></span>
|
||||
<span id="cb75-14"><a href="#cb75-14" aria-hidden="true" tabindex="-1"></a> ZBarcode_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb75-15"><a href="#cb75-15" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>my_symbol<span class="op">);</span></span>
|
||||
<span id="cb75-9"><a href="#cb75-9" aria-hidden="true" tabindex="-1"></a> <span class="kw">struct</span> zint_symbol <span class="op">*</span>symbol<span class="op">;</span></span>
|
||||
<span id="cb75-10"><a href="#cb75-10" aria-hidden="true" tabindex="-1"></a> symbol <span class="op">=</span> ZBarcode_Create<span class="op">();</span></span>
|
||||
<span id="cb75-11"><a href="#cb75-11" aria-hidden="true" tabindex="-1"></a> symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_AZTEC<span class="op">;</span></span>
|
||||
<span id="cb75-12"><a href="#cb75-12" aria-hidden="true" tabindex="-1"></a> symbol<span class="op">-></span>input_mode <span class="op">=</span> UNICODE_MODE<span class="op">;</span></span>
|
||||
<span id="cb75-13"><a href="#cb75-13" aria-hidden="true" tabindex="-1"></a> ZBarcode_Encode_Segs<span class="op">(</span>symbol<span class="op">,</span> segs<span class="op">,</span> <span class="dv">3</span><span class="op">);</span></span>
|
||||
<span id="cb75-14"><a href="#cb75-14" aria-hidden="true" tabindex="-1"></a> ZBarcode_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb75-15"><a href="#cb75-15" aria-hidden="true" tabindex="-1"></a> ZBarcode_Delete<span class="op">(</span>symbol<span class="op">);</span></span>
|
||||
<span id="cb75-16"><a href="#cb75-16" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="dv">0</span><span class="op">;</span></span>
|
||||
<span id="cb75-17"><a href="#cb75-17" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
<p>A maximum of 256 segments may be specified. Use of multiple segments
|
||||
@@ -4186,12 +4187,12 @@ is assumed. For raster output (BMP/GIF/PCX/PNG/TIF) the scale is rounded
|
||||
to half-integer increments.</p>
|
||||
<p>For example:</p>
|
||||
<div class="sourceCode" id="cb77"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb77-1"><a href="#cb77-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* Royal Mail 4-State Customer Code */</span></span>
|
||||
<span id="cb77-2"><a href="#cb77-2" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_RM4SCC<span class="op">;</span></span>
|
||||
<span id="cb77-3"><a href="#cb77-3" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>dpmm <span class="op">=</span> <span class="fl">600.0</span><span class="bu">f</span> <span class="op">/</span> <span class="fl">25.4</span><span class="bu">f</span><span class="op">;</span> <span class="co">/* 600 dpi */</span></span>
|
||||
<span id="cb77-4"><a href="#cb77-4" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>scale <span class="op">=</span> ZBarcode_Scale_From_XdimDp<span class="op">(</span></span>
|
||||
<span id="cb77-5"><a href="#cb77-5" aria-hidden="true" tabindex="-1"></a> my_symbol<span class="op">-></span>symbology<span class="op">,</span></span>
|
||||
<span id="cb77-6"><a href="#cb77-6" aria-hidden="true" tabindex="-1"></a> ZBarcode_Default_Xdim<span class="op">(</span>my_symbol<span class="op">-></span>symbology<span class="op">),</span></span>
|
||||
<span id="cb77-7"><a href="#cb77-7" aria-hidden="true" tabindex="-1"></a> my_symbol<span class="op">-></span>dpmm<span class="op">,</span> <span class="st">"PNG"</span><span class="op">);</span> <span class="co">/* Returns 7.5 */</span></span></code></pre></div>
|
||||
<span id="cb77-2"><a href="#cb77-2" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_RM4SCC<span class="op">;</span></span>
|
||||
<span id="cb77-3"><a href="#cb77-3" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>dpmm <span class="op">=</span> <span class="fl">600.0</span><span class="bu">f</span> <span class="op">/</span> <span class="fl">25.4</span><span class="bu">f</span><span class="op">;</span> <span class="co">/* 600 dpi */</span></span>
|
||||
<span id="cb77-4"><a href="#cb77-4" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>scale <span class="op">=</span> ZBarcode_Scale_From_XdimDp<span class="op">(</span></span>
|
||||
<span id="cb77-5"><a href="#cb77-5" aria-hidden="true" tabindex="-1"></a> symbol<span class="op">-></span>symbology<span class="op">,</span></span>
|
||||
<span id="cb77-6"><a href="#cb77-6" aria-hidden="true" tabindex="-1"></a> ZBarcode_Default_Xdim<span class="op">(</span>symbol<span class="op">-></span>symbology<span class="op">),</span></span>
|
||||
<span id="cb77-7"><a href="#cb77-7" aria-hidden="true" tabindex="-1"></a> symbol<span class="op">-></span>dpmm<span class="op">,</span> <span class="st">"PNG"</span><span class="op">);</span> <span class="co">/* Returns 7.5 */</span></span></code></pre></div>
|
||||
<p>The third function <code>ZBarcode_XdimDP_From_Scale()</code> is the
|
||||
“reverse” of <code>ZBarcode_Scale_From_XdimDp()</code>, returning the
|
||||
X-dimension (in mm) or the dot density (in dpmm) given a scale
|
||||
@@ -4357,13 +4358,13 @@ less than 5% + 3 codewords and <code>-1</code> meaning minimum 3
|
||||
codewords). Micro PDF417 also will return the ECC percentage in
|
||||
<code>option_1</code> as <code>P << 8</code>.</p>
|
||||
<p>Detailed feedback on the data encoded may be requested by specifying
|
||||
the <code>BARCODE_RAW_TEXT</code> option in the
|
||||
the <code>BARCODE_CONTENT_SEGS</code> option in the
|
||||
<code>output_options</code> member, which will populate the
|
||||
<code>raw_segs</code> member with an array of <code>zint_seg</code>
|
||||
<code>content_segs</code> member with an array of <code>zint_seg</code>
|
||||
structures (see <a href="#multiple-segments-1">5.12 Multiple
|
||||
Segments</a> for the format), one for each segment specified, the size
|
||||
of the array being set in <code>raw_seg_count</code> - which will always
|
||||
be at least one.</p>
|
||||
of the array being set in <code>content_seg_count</code> - which will
|
||||
always be at least one.</p>
|
||||
<p>The <code>source</code>, <code>length</code> and <code>eci</code>
|
||||
members of <code>zint_seg</code> will be set accordingly - the
|
||||
unconverted data in <code>source</code>, the data length in
|
||||
@@ -4573,17 +4574,17 @@ symbology <code>BARCODE_UPCA_CHK</code> (35), which verifies that the
|
||||
last digit is a check digit. Input less than 11 digits will be
|
||||
zero-filled.</p>
|
||||
<p>In addition 2-digit and 5-digit add-on symbols can be added, their
|
||||
data separated from the main data by a <code>+</code> character or a
|
||||
data separated from the main data by a <code>'+'</code> character or a
|
||||
space. For example, to draw a UPC-A symbol with the data “72527270270”
|
||||
and 5-digit add-on data “12345” use the command:</p>
|
||||
<div class="sourceCode" id="cb88"><pre
|
||||
class="sourceCode bash"><code class="sourceCode bash"><span id="cb88-1"><a href="#cb88-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> UPCA <span class="at">-d</span> <span class="st">"72527270270+12345"</span></span></code></pre></div>
|
||||
<p>or using the API:</p>
|
||||
<div class="sourceCode" id="cb89"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb89-1"><a href="#cb89-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_UPCA<span class="op">;</span></span>
|
||||
<div class="sourceCode" id="cb89"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb89-1"><a href="#cb89-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_UPCA<span class="op">;</span></span>
|
||||
<span id="cb89-2"><a href="#cb89-2" aria-hidden="true" tabindex="-1"></a><span class="co">/* Using '+' */</span></span>
|
||||
<span id="cb89-3"><a href="#cb89-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"72527270270+12345"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb89-3"><a href="#cb89-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"72527270270+12345"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb89-4"><a href="#cb89-4" aria-hidden="true" tabindex="-1"></a><span class="co">/* Or a space */</span></span>
|
||||
<span id="cb89-5"><a href="#cb89-5" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"72527270270 12345"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<span id="cb89-5"><a href="#cb89-5" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"72527270270 12345"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<figure>
|
||||
<img src="images/upca_5.svg" class="upcean"
|
||||
alt="zint -b UPCA --compliantheight -d "72527270270+12345"" />
|
||||
@@ -4597,9 +4598,9 @@ is only relevant when there is an add-on:</p>
|
||||
<div class="sourceCode" id="cb90"><pre
|
||||
class="sourceCode bash"><code class="sourceCode bash"><span id="cb90-1"><a href="#cb90-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> UPCA <span class="at">-d</span> <span class="st">"72527270270+12345"</span> <span class="at">--guardwhitespace</span></span></code></pre></div>
|
||||
<p>or using the API:</p>
|
||||
<div class="sourceCode" id="cb91"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb91-1"><a href="#cb91-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_UPCA<span class="op">;</span></span>
|
||||
<span id="cb91-2"><a href="#cb91-2" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>output_options <span class="op">|=</span> EANUPC_GUARD_WHITESPACE<span class="op">;</span></span>
|
||||
<span id="cb91-3"><a href="#cb91-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"72527270270+12345"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb91"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb91-1"><a href="#cb91-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_UPCA<span class="op">;</span></span>
|
||||
<span id="cb91-2"><a href="#cb91-2" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>output_options <span class="op">|=</span> EANUPC_GUARD_WHITESPACE<span class="op">;</span></span>
|
||||
<span id="cb91-3"><a href="#cb91-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"72527270270+12345"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<figure>
|
||||
<img src="images/upca_5_gws.svg" class="upcean"
|
||||
alt="zint -b UPCA --compliantheight -d "72527270270+12345" --guardwhitespace" />
|
||||
@@ -4630,7 +4631,7 @@ which case Zint will verify the check digit, or the symbology
|
||||
<code>BARCODE_UPCE_CHK</code> (38) may be used, which will verify that
|
||||
the last digit is a check digit before encoding.</p>
|
||||
<p>As with UPC-A, 2-digit and 5-digit add-on symbols can be added using
|
||||
a <code>+</code> character or a space as a separator, and a quiet zone
|
||||
a <code>'+'</code> character or a space as a separator, and a quiet zone
|
||||
indicator can be added when there is an add-on by setting
|
||||
<code>--guardwhitespace</code> (API
|
||||
<code>output_options |= EANUPC_GUARD_WHITESPACE</code>):</p>
|
||||
@@ -4674,8 +4675,8 @@ character as with UPC symbols. For example:</p>
|
||||
class="sourceCode bash"><code class="sourceCode bash"><span id="cb93-1"><a href="#cb93-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> EAN13 <span class="at">-d</span> <span class="st">"451234567890+21"</span></span></code></pre></div>
|
||||
<p>will encode an EAN-13 symbol with a 2-digit add-on. As before these
|
||||
results can be achieved using the API:</p>
|
||||
<div class="sourceCode" id="cb94"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb94-1"><a href="#cb94-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_EAN13<span class="op">;</span></span>
|
||||
<span id="cb94-2"><a href="#cb94-2" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"451234567890+21"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb94"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb94-1"><a href="#cb94-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_EAN13<span class="op">;</span></span>
|
||||
<span id="cb94-2"><a href="#cb94-2" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"451234567890+21"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<figure>
|
||||
<img src="images/ean13_2.svg" class="upcean"
|
||||
alt="zint -b EAN13 --compliantheight -d "451234567890+21"" />
|
||||
@@ -4713,9 +4714,9 @@ Version E</a>. For instance:</p>
|
||||
<div class="sourceCode" id="cb96"><pre
|
||||
class="sourceCode bash"><code class="sourceCode bash"><span id="cb96-1"><a href="#cb96-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> EAN8 <span class="at">-d</span> <span class="st">"7432365"</span> <span class="at">--guardwhitespace</span></span></code></pre></div>
|
||||
<p>or using the API:</p>
|
||||
<div class="sourceCode" id="cb97"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb97-1"><a href="#cb97-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_EAN8<span class="op">;</span></span>
|
||||
<span id="cb97-2"><a href="#cb97-2" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>output_options <span class="op">|=</span> EANUPC_GUARD_WHITESPACE<span class="op">;</span></span>
|
||||
<span id="cb97-3"><a href="#cb97-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"7432365"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb97"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb97-1"><a href="#cb97-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_EAN8<span class="op">;</span></span>
|
||||
<span id="cb97-2"><a href="#cb97-2" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>output_options <span class="op">|=</span> EANUPC_GUARD_WHITESPACE<span class="op">;</span></span>
|
||||
<span id="cb97-3"><a href="#cb97-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"7432365"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<figure>
|
||||
<img src="images/ean8_gws.svg" class="upcean"
|
||||
alt="zint -b EAN8 --compliantheight -d "7432365" –guardwhitespace" />
|
||||
@@ -4767,9 +4768,9 @@ using <code>---guardwhitespace</code>. For instance</p>
|
||||
class="sourceCode bash"><code class="sourceCode bash"><span id="cb98-1"><a href="#cb98-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> EAN_5ADDON <span class="at">-d</span> <span class="st">"54321"</span> <span class="at">--guardwhitespace</span></span></code></pre></div>
|
||||
<p>will generate a standalone 5-digit add-on with quiet zone guards, or
|
||||
using the API:</p>
|
||||
<div class="sourceCode" id="cb99"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb99-1"><a href="#cb99-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_EAN_5ADDON<span class="op">;</span></span>
|
||||
<span id="cb99-2"><a href="#cb99-2" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>output_options <span class="op">|=</span> EANUPC_GUARD_WHITESPACE<span class="op">;</span></span>
|
||||
<span id="cb99-3"><a href="#cb99-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"54321"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb99"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb99-1"><a href="#cb99-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_EAN_5ADDON<span class="op">;</span></span>
|
||||
<span id="cb99-2"><a href="#cb99-2" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>output_options <span class="op">|=</span> EANUPC_GUARD_WHITESPACE<span class="op">;</span></span>
|
||||
<span id="cb99-3"><a href="#cb99-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"54321"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<figure>
|
||||
<img src="images/ean_5addon_gws.svg" class="upcean"
|
||||
alt="zint -b EAN_5ADDON --compliantheight -d "54321" –guardwhitespace" />
|
||||
@@ -5375,10 +5376,10 @@ result can be achieved using the API by executing the
|
||||
<code>ZBarcode_Encode()</code> function more than once on a symbol. For
|
||||
example:</p>
|
||||
<div class="sourceCode" id="cb107"><pre
|
||||
class="sourceCode c"><code class="sourceCode c"><span id="cb107-1"><a href="#cb107-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_CODE128<span class="op">;</span></span>
|
||||
<span id="cb107-2"><a href="#cb107-2" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"This"</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb107-3"><a href="#cb107-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"That"</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb107-4"><a href="#cb107-4" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Print<span class="op">(</span>my_symbol<span class="op">);</span></span></code></pre></div>
|
||||
class="sourceCode c"><code class="sourceCode c"><span id="cb107-1"><a href="#cb107-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_CODE128<span class="op">;</span></span>
|
||||
<span id="cb107-2"><a href="#cb107-2" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"This"</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb107-3"><a href="#cb107-3" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Encode<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"That"</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span>
|
||||
<span id="cb107-4"><a href="#cb107-4" aria-hidden="true" tabindex="-1"></a>error <span class="op">=</span> ZBarcode_Print<span class="op">(</span>symbol<span class="op">);</span></span></code></pre></div>
|
||||
<figure>
|
||||
<img src="images/code128_stacked.svg" class="lin"
|
||||
alt="zint -d "This" -d "That"" />
|
||||
@@ -5492,13 +5493,13 @@ alt="zint -b PDF417COMP -d "PDF417"" />
|
||||
</figure>
|
||||
<h3 id="micropdf417-iso-24728">6.2.6 MicroPDF417 (ISO 24728)</h3>
|
||||
<p>A variation of the PDF417 standard, MicroPDF417 is intended for
|
||||
applications where symbol size needs to be kept to a minimum. 34
|
||||
predefined symbol sizes are available with 1 - 4 columns and 4 - 44
|
||||
rows. The maximum amount a MicroPDF417 symbol can hold is 250
|
||||
alphanumeric characters or 366 digits. The amount of error correction
|
||||
used is dependent on symbol size. The number of columns used can be
|
||||
determined using the <code>--cols</code> switch (API
|
||||
<code>option_2</code>) as with PDF417.</p>
|
||||
applications where symbol size needs to be kept to a minimum. Its size
|
||||
ranges over 1 - 4 data columns and 4 - 44 rows. The maximum amount a
|
||||
MicroPDF417 symbol can hold is 250 alphanumeric characters or 366
|
||||
digits. The amount of error correction used is dependent on symbol size.
|
||||
The number of data columns used can be determined using the
|
||||
<code>--cols</code> switch (API <code>option_2</code>) as with PDF417.
|
||||
The amount of data determines the number of rows.</p>
|
||||
<figure>
|
||||
<img src="images/micropdf417.svg" class="lin"
|
||||
alt="zint -b MICROPDF417 -d "12345678"" />
|
||||
@@ -5692,12 +5693,12 @@ href="#cc-a">below</a>) component with the data
|
||||
<code>"(99)1234-abcd"</code>. The same results can be achieved using the
|
||||
API as shown below:</p>
|
||||
<div class="sourceCode" id="cb110"><pre
|
||||
class="sourceCode c"><code class="sourceCode c"><span id="cb110-1"><a href="#cb110-1" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_EAN13_CC<span class="op">;</span></span>
|
||||
<span id="cb110-2"><a href="#cb110-2" aria-hidden="true" tabindex="-1"></a>my_symbol<span class="op">-></span>option_1 <span class="op">=</span> <span class="dv">1</span><span class="op">;</span></span>
|
||||
<span id="cb110-3"><a href="#cb110-3" aria-hidden="true" tabindex="-1"></a>strcpy<span class="op">(</span>my_symbol<span class="op">-></span>primary<span class="op">,</span> <span class="st">"331234567890"</span><span class="op">);</span></span>
|
||||
<span id="cb110-4"><a href="#cb110-4" aria-hidden="true" tabindex="-1"></a>ZBarcode_Encode_and_Print<span class="op">(</span>my_symbol<span class="op">,</span> <span class="st">"[99]1234-abcd"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
class="sourceCode c"><code class="sourceCode c"><span id="cb110-1"><a href="#cb110-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>symbology <span class="op">=</span> BARCODE_EAN13_CC<span class="op">;</span></span>
|
||||
<span id="cb110-2"><a href="#cb110-2" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-></span>option_1 <span class="op">=</span> <span class="dv">1</span><span class="op">;</span></span>
|
||||
<span id="cb110-3"><a href="#cb110-3" aria-hidden="true" tabindex="-1"></a>strcpy<span class="op">(</span>symbol<span class="op">-></span>primary<span class="op">,</span> <span class="st">"331234567890"</span><span class="op">);</span></span>
|
||||
<span id="cb110-4"><a href="#cb110-4" aria-hidden="true" tabindex="-1"></a>ZBarcode_Encode_and_Print<span class="op">(</span>symbol<span class="op">,</span> <span class="st">"[99]1234-abcd"</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">0</span><span class="op">);</span></span></code></pre></div>
|
||||
<p>2-digit and 5-digit add-on data can be used with EAN and UPC symbols
|
||||
using the <code>+</code> character as described in sections <a
|
||||
using the <code>'+'</code> character as described in sections <a
|
||||
href="#upc-universal-product-code-iso-15420">6.1.3 UPC (Universal
|
||||
Product Code) (ISO 15420)</a> and <a
|
||||
href="#ean-european-article-number-iso-15420">6.1.4 EAN (European
|
||||
@@ -9723,9 +9724,9 @@ Edge Barcode and Flattermarken. Note that HRT is never shown for stacked
|
||||
and matrix barcodes.<a href="#fnref6" class="footnote-back"
|
||||
role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn7"><p>Shift JIS (JIS X 0201 Roman) re-maps two ASCII
|
||||
characters: backslash (<code>\</code>) to the yen sign (¥), and tilde
|
||||
(<code>~</code>) to overline (U+203E).<a href="#fnref7"
|
||||
class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
characters: backslash (<code>\</code>) to the yen sign (<code>¥</code>),
|
||||
and tilde (<code>~</code>) to overline (<code>‾</code>, U+203E).<a
|
||||
href="#fnref7" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
<li id="fn8"><p>ISO/IEC 646 Invariant is a subset of ASCII with 12
|
||||
characters undefined: <code>#</code>, <code>$</code>, <code>@</code>,
|
||||
<code>[</code>, <code>\</code>, <code>]</code>, <code>^</code>,
|
||||
|
||||
251
docs/manual.pmd
251
docs/manual.pmd
@@ -1,6 +1,6 @@
|
||||
% Zint Barcode Generator and Zint Barcode Studio User Manual
|
||||
% Version 2.15.0.9
|
||||
% October 2025
|
||||
% November 2025
|
||||
|
||||
# 1. Introduction
|
||||
|
||||
@@ -1270,7 +1270,7 @@ All others ASCII N/A
|
||||
Table: Default Character Sets {#tbl:default_character_sets}
|
||||
|
||||
[^7]: Shift JIS (JIS X 0201 Roman) re-maps two ASCII characters: backslash (`\`)
|
||||
to the yen sign (¥), and tilde (`~`) to overline (U+203E).
|
||||
to the yen sign (`¥`), and tilde (`~`) to overline (`‾`, U+203E).
|
||||
|
||||
If Zint encounters characters which can not be encoded using the default
|
||||
character encoding then it will take advantage of the ECI (Extended Channel
|
||||
@@ -1618,7 +1618,7 @@ Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode.
|
||||
The `--structapp` option marks a symbol as part of a Structured Append sequence,
|
||||
and has the format
|
||||
|
||||
```
|
||||
```bash
|
||||
--structapp=I,C[,ID]
|
||||
```
|
||||
|
||||
@@ -1682,11 +1682,11 @@ following code creates and then deletes a symbol:
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
if (my_symbol != NULL) {
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
if (symbol != NULL) {
|
||||
printf("Symbol successfully created!\n");
|
||||
ZBarcode_Delete(my_symbol);
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1711,11 +1711,11 @@ the current working directory:
|
||||
#include <zint.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
ZBarcode_Encode(my_symbol, argv[1], 0);
|
||||
ZBarcode_Print(my_symbol, 0);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
ZBarcode_Encode(symbol, argv[1], 0);
|
||||
ZBarcode_Print(symbol, 0);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
@@ -1727,10 +1727,10 @@ function as shown in the next example:
|
||||
#include <zint.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
ZBarcode_Encode_and_Print(symbol, argv[1], 0, 0);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
@@ -1817,13 +1817,13 @@ client application:
|
||||
```c
|
||||
int row, col, i = 0, j = 0;
|
||||
|
||||
for (row = 0; row < my_symbol->bitmap_height; row++) {
|
||||
for (col = 0; col < my_symbol->bitmap_width; col++) {
|
||||
int red = (int) my_symbol->bitmap[i];
|
||||
int green = (int) my_symbol->bitmap[i + 1];
|
||||
int blue = (int) my_symbol->bitmap[i + 2];
|
||||
if (my_symbol->alphamap) {
|
||||
int alpha = (int) my_symbol->alphamap[j];
|
||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||
for (col = 0; col < symbol->bitmap_width; col++) {
|
||||
int red = (int) symbol->bitmap[i];
|
||||
int green = (int) symbol->bitmap[i + 1];
|
||||
int blue = (int) symbol->bitmap[i + 2];
|
||||
if (symbol->alphamap) {
|
||||
int alpha = (int) symbol->alphamap[j];
|
||||
render_rgba(row, col, red, green, blue, alpha);
|
||||
j++;
|
||||
} else {
|
||||
@@ -1845,9 +1845,9 @@ yellow, `'G'` for green, and `'K'` for black. Alpha values are not reported
|
||||
```c
|
||||
int row, col, i = 0;
|
||||
|
||||
for (row = 0; row < my_symbol->bitmap_height; row++) {
|
||||
for (col = 0; col < my_symbol->bitmap_width; col++) {
|
||||
render_pixel(row, col, my_symbol->bitmap[i]);
|
||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||
for (col = 0; col < symbol->bitmap_width; col++) {
|
||||
render_pixel(row, col, symbol->bitmap[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -1883,23 +1883,23 @@ struct zint_vector_hexagon *hex;
|
||||
struct zint_vector_string *string;
|
||||
struct zint_vector_circle *circle;
|
||||
|
||||
prepare_canvas(my_symbol->vector->width, my_symbol->vector->height,
|
||||
my_symbol->scale, my_symbol->fgcolour, my_symbol->bgcolour,
|
||||
prepare_canvas(symbol->vector->width, symbol->vector->height,
|
||||
symbol->scale, symbol->fgcolour, symbol->bgcolour,
|
||||
rotate_angle);
|
||||
|
||||
for (rect = my_symbol->vector->rectangles; rect; rect = rect->next) {
|
||||
for (rect = symbol->vector->rectangles; rect; rect = rect->next) {
|
||||
draw_rect(rect->x, rect->y, rect->width, rect->height,
|
||||
rect->colour);
|
||||
}
|
||||
for (hex = my_symbol->vector->hexagons; hex; hex = hex->next) {
|
||||
for (hex = symbol->vector->hexagons; hex; hex = hex->next) {
|
||||
draw_hexagon(hex->x, hex->y, hex->diameter, hex->rotation);
|
||||
}
|
||||
for (string = my_symbol->vector->strings; string; string = string->next) {
|
||||
for (string = symbol->vector->strings; string; string = string->next) {
|
||||
draw_string(string->x, string->y, string->fsize,
|
||||
string->rotation, string->halign,
|
||||
string->text, string->length);
|
||||
}
|
||||
for (circle = my_symbol->vector->circles; circle; circle = circle->next) {
|
||||
for (circle = symbol->vector->circles; circle; circle = circle->next) {
|
||||
draw_circle(circle->x, circle->y, circle->diameter, circle->width);
|
||||
}
|
||||
```
|
||||
@@ -1917,15 +1917,15 @@ length of the buffer is given in `memfile_size`. For instance:
|
||||
#include <string.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
my_symbol->output_options |= BARCODE_MEMORY_FILE;
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
symbol->output_options |= BARCODE_MEMORY_FILE;
|
||||
/* Only the extension is used, to determine output format */
|
||||
strcpy(my_symbol->outfile, "mem.svg");
|
||||
ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0);
|
||||
/* `my_symbol->memfile` now contains the SVG output */
|
||||
fwrite(my_symbol->memfile, 1, my_symbol->memfile_size, stdout);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
strcpy(symbol->outfile, "mem.svg");
|
||||
ZBarcode_Encode_and_Print(symbol, argv[1], 0, 0);
|
||||
/* `symbol->memfile` now contains the SVG output */
|
||||
fwrite(symbol->memfile, 1, symbol->memfile_size, stdout);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2071,14 +2071,6 @@ Member Name Type Meaning Default Value
|
||||
`width` integer Width of the generated (output only)
|
||||
symbol.
|
||||
|
||||
`encoded_data` array of Representation of the (output only)
|
||||
unsigned encoded data.
|
||||
character
|
||||
arrays
|
||||
|
||||
`row_height` array of Heights of each row. (output only)
|
||||
floats
|
||||
|
||||
`errtxt` character Error message in the (output only)
|
||||
string event that an error
|
||||
occurred, with a
|
||||
@@ -2122,13 +2114,22 @@ Member Name Type Meaning Default Value
|
||||
`memfile_size` integer Length of in-memory file (output only)
|
||||
buffer.
|
||||
|
||||
`raw_segs` pointer to Pointer to array of raw (output only)
|
||||
array of segments if
|
||||
segments `BARCODE_RAW_TEXT` set in
|
||||
`output_options` - see
|
||||
[5.16 Feedback].
|
||||
`content_segs` pointer to Pointer to array of (output only)
|
||||
array of content segments if
|
||||
segments `BARCODE_CONTENT_SEGS`
|
||||
set in `output_options`
|
||||
- see [5.16 Feedback].
|
||||
|
||||
`raw_seg_count` integer Number of raw segments. (output only)
|
||||
`content_seg_count` integer Number of content (output only)
|
||||
segments.
|
||||
|
||||
`encoded_data` array of Representation of the (output only)
|
||||
unsigned encoded data.
|
||||
character
|
||||
arrays
|
||||
|
||||
`row_height` array of Heights of each row. (output only)
|
||||
floats
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Table: API Structure `zint_symbol` {#tbl:api_structure_zint_symbol}
|
||||
@@ -2150,12 +2151,12 @@ plotted in green.
|
||||
#include <string.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
strcpy(my_symbol->fgcolour, "00ff00");
|
||||
my_symbol->height = 400.0f;
|
||||
ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
strcpy(symbol->fgcolour, "00ff00");
|
||||
symbol->height = 400.0f;
|
||||
ZBarcode_Encode_and_Print(symbol, argv[1], 0, 0);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
@@ -2165,7 +2166,7 @@ setting the background alpha to `"00"` where the values for R, G and B will be
|
||||
ignored:
|
||||
|
||||
```c
|
||||
strcpy(my_symbol->bgcolour, "55555500");
|
||||
strcpy(symbol->bgcolour, "55555500");
|
||||
```
|
||||
|
||||
This is what the CLI option `--nobackground` does - see [4.7 Using Colour].
|
||||
@@ -2252,23 +2253,23 @@ To catch errors use an integer variable as shown in the code below:
|
||||
#include <string.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
struct zint_symbol *symbol;
|
||||
int error;
|
||||
my_symbol = ZBarcode_Create();
|
||||
symbol = ZBarcode_Create();
|
||||
/* Set invalid foreground colour */
|
||||
strcpy(my_symbol->fgcolour, "nonsense");
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0);
|
||||
strcpy(symbol->fgcolour, "nonsense");
|
||||
error = ZBarcode_Encode_and_Print(symbol, argv[1], 0, 0);
|
||||
if (error != 0) {
|
||||
/* Some warning or error occurred */
|
||||
printf("%s\n", my_symbol->errtxt);
|
||||
printf("%s\n", symbol->errtxt);
|
||||
if (error >= ZINT_ERROR) {
|
||||
/* Stop now */
|
||||
ZBarcode_Delete(my_symbol);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* Otherwise carry on with the rest of the application */
|
||||
ZBarcode_Delete(my_symbol);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
@@ -2297,7 +2298,7 @@ file. To select more than one option from the table below simply `OR` them
|
||||
together when adjusting this value:
|
||||
|
||||
```c
|
||||
my_symbol->output_options |= BARCODE_BIND | READER_INIT;
|
||||
symbol->output_options |= BARCODE_BIND | READER_INIT;
|
||||
```
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
@@ -2351,8 +2352,8 @@ Value Effect
|
||||
`BARCODE_MEMORY_FILE` Write output to in-memory buffer `symbol->memfile`
|
||||
instead of to `outfile` file.
|
||||
|
||||
`BARCODE_RAW_TEXT` Write data encoded to raw segment buffers
|
||||
`symbol->raw_segs` (see [5.16 Feedback]).
|
||||
`BARCODE_CONTENT_SEGS` Write data encoded to content segment buffers
|
||||
`symbol->contentsegs` (see [5.16 Feedback]).
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Table: API `output_options` Values {#tbl:api_output_options}
|
||||
@@ -2420,19 +2421,19 @@ from the default for the CLI and GUI, which is `UNICODE_MODE`.)
|
||||
for example, you can set
|
||||
|
||||
```c
|
||||
my_symbol->input_mode = UNICODE_MODE | ESCAPE_MODE;
|
||||
symbol->input_mode = UNICODE_MODE | ESCAPE_MODE;
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```c
|
||||
my_symbol->input_mode = GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE;
|
||||
symbol->input_mode = GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE;
|
||||
```
|
||||
|
||||
whereas
|
||||
|
||||
```c
|
||||
my_symbol->input_mode = DATA_MODE | GS1_MODE;
|
||||
symbol->input_mode = DATA_MODE | GS1_MODE;
|
||||
```
|
||||
|
||||
is not valid.
|
||||
@@ -2510,13 +2511,13 @@ int main(int argc, char **argv)
|
||||
{ "Текст", 0, 7 },
|
||||
{ "文章", 0, 20 }
|
||||
};
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
my_symbol->symbology = BARCODE_AZTEC;
|
||||
my_symbol->input_mode = UNICODE_MODE;
|
||||
ZBarcode_Encode_Segs(my_symbol, segs, 3);
|
||||
ZBarcode_Print(my_symbol, 0);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
symbol->symbology = BARCODE_AZTEC;
|
||||
symbol->input_mode = UNICODE_MODE;
|
||||
ZBarcode_Encode_Segs(symbol, segs, 3);
|
||||
ZBarcode_Print(symbol, 0);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
@@ -2552,12 +2553,12 @@ For example:
|
||||
|
||||
```c
|
||||
/* Royal Mail 4-State Customer Code */
|
||||
my_symbol->symbology = BARCODE_RM4SCC;
|
||||
my_symbol->dpmm = 600.0f / 25.4f; /* 600 dpi */
|
||||
my_symbol->scale = ZBarcode_Scale_From_XdimDp(
|
||||
my_symbol->symbology,
|
||||
ZBarcode_Default_Xdim(my_symbol->symbology),
|
||||
my_symbol->dpmm, "PNG"); /* Returns 7.5 */
|
||||
symbol->symbology = BARCODE_RM4SCC;
|
||||
symbol->dpmm = 600.0f / 25.4f; /* 600 dpi */
|
||||
symbol->scale = ZBarcode_Scale_From_XdimDp(
|
||||
symbol->symbology,
|
||||
ZBarcode_Default_Xdim(symbol->symbology),
|
||||
symbol->dpmm, "PNG"); /* Returns 7.5 */
|
||||
```
|
||||
|
||||
The third function `ZBarcode_XdimDP_From_Scale()` is the "reverse" of
|
||||
@@ -2701,10 +2702,11 @@ the addition of `0` meaning less than 5% + 3 codewords and `-1` meaning minimum
|
||||
`P << 8`.
|
||||
|
||||
Detailed feedback on the data encoded may be requested by specifying the
|
||||
`BARCODE_RAW_TEXT` option in the `output_options` member, which will populate
|
||||
the `raw_segs` member with an array of `zint_seg` structures (see [5.12 Multiple
|
||||
Segments] for the format), one for each segment specified, the size of the array
|
||||
being set in `raw_seg_count` - which will always be at least one.
|
||||
`BARCODE_CONTENT_SEGS` option in the `output_options` member, which will
|
||||
populate the `content_segs` member with an array of `zint_seg` structures (see
|
||||
[5.12 Multiple Segments] for the format), one for each segment specified, the
|
||||
size of the array being set in `content_seg_count` - which will always be at
|
||||
least one.
|
||||
|
||||
The `source`, `length` and `eci` members of `zint_seg` will be set accordingly -
|
||||
the unconverted data in `source`, the data length in `length`, and the character
|
||||
@@ -2921,9 +2923,9 @@ case Zint will verify the check digit, or you may use symbology
|
||||
Input less than 11 digits will be zero-filled.
|
||||
|
||||
In addition 2-digit and 5-digit add-on symbols can be added, their data
|
||||
separated from the main data by a `+` character or a space. For example, to draw
|
||||
a UPC-A symbol with the data "72527270270" and 5-digit add-on data "12345" use
|
||||
the command:
|
||||
separated from the main data by a `'+'` character or a space. For example, to
|
||||
draw a UPC-A symbol with the data "72527270270" and 5-digit add-on data "12345"
|
||||
use the command:
|
||||
|
||||
```bash
|
||||
zint -b UPCA -d "72527270270+12345"
|
||||
@@ -2932,11 +2934,11 @@ zint -b UPCA -d "72527270270+12345"
|
||||
or using the API:
|
||||
|
||||
```c
|
||||
my_symbol->symbology = BARCODE_UPCA;
|
||||
symbol->symbology = BARCODE_UPCA;
|
||||
/* Using '+' */
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, "72527270270+12345", 0, 0);
|
||||
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0);
|
||||
/* Or a space */
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, "72527270270 12345", 0, 0);
|
||||
error = ZBarcode_Encode_and_Print(symbol, "72527270270 12345", 0, 0);
|
||||
```
|
||||
|
||||
{.lin}
|
||||
@@ -3711,11 +3713,12 @@ above.
|
||||
### 6.2.6 MicroPDF417 (ISO 24728)
|
||||
|
||||
A variation of the PDF417 standard, MicroPDF417 is intended for applications
|
||||
where symbol size needs to be kept to a minimum. 34 predefined symbol sizes are
|
||||
available with 1 - 4 columns and 4 - 44 rows. The maximum amount a MicroPDF417
|
||||
symbol can hold is 250 alphanumeric characters or 366 digits. The amount of
|
||||
error correction used is dependent on symbol size. The number of columns used
|
||||
can be determined using the `--cols` switch (API `option_2`) as with PDF417.
|
||||
where symbol size needs to be kept to a minimum. Its size ranges over 1 - 4 data
|
||||
columns and 4 - 44 rows. The maximum amount a MicroPDF417 symbol can hold is 250
|
||||
alphanumeric characters or 366 digits. The amount of error correction used is
|
||||
dependent on symbol size. The number of data columns used can be determined
|
||||
using the `--cols` switch (API `option_2`) as with PDF417. The amount of data
|
||||
determines the number of rows.
|
||||
|
||||
{.lin}
|
||||
|
||||
@@ -3852,15 +3855,15 @@ CC-A (see [below][6.3.1 CC-A]) component with the data `"(99)1234-abcd"`. The
|
||||
same results can be achieved using the API as shown below:
|
||||
|
||||
```c
|
||||
my_symbol->symbology = BARCODE_EAN13_CC;
|
||||
my_symbol->option_1 = 1;
|
||||
strcpy(my_symbol->primary, "331234567890");
|
||||
ZBarcode_Encode_and_Print(my_symbol, "[99]1234-abcd", 0, 0);
|
||||
symbol->symbology = BARCODE_EAN13_CC;
|
||||
symbol->option_1 = 1;
|
||||
strcpy(symbol->primary, "331234567890");
|
||||
ZBarcode_Encode_and_Print(symbol, "[99]1234-abcd", 0, 0);
|
||||
```
|
||||
|
||||
2-digit and 5-digit add-on data can be used with EAN and UPC symbols using the
|
||||
`+` character as described in sections [6.1.3 UPC (Universal Product Code) (ISO
|
||||
15420)] and [6.1.4 EAN (European Article Number) (ISO 15420)].
|
||||
`'+'` character as described in sections [6.1.3 UPC (Universal Product Code)
|
||||
(ISO 15420)] and [6.1.4 EAN (European Article Number) (ISO 15420)].
|
||||
|
||||
The 2D component of a composite symbol can use one of three systems: CC-A, CC-B
|
||||
and CC-C, as described below. The 2D component type can be selected
|
||||
|
||||
250
docs/manual.txt
250
docs/manual.txt
@@ -1,6 +1,6 @@
|
||||
Zint Barcode Generator and Zint Barcode Studio User Manual
|
||||
Version 2.15.0.9
|
||||
October 2025
|
||||
November 2025
|
||||
|
||||
*******************************************************************************
|
||||
* For reference the following is a text-only version of the Zint manual, *
|
||||
@@ -1722,11 +1722,11 @@ following code creates and then deletes a symbol:
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
if (my_symbol != NULL) {
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
if (symbol != NULL) {
|
||||
printf("Symbol successfully created!\n");
|
||||
ZBarcode_Delete(my_symbol);
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1747,11 +1747,11 @@ current working directory:
|
||||
#include <zint.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
ZBarcode_Encode(my_symbol, argv[1], 0);
|
||||
ZBarcode_Print(my_symbol, 0);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
ZBarcode_Encode(symbol, argv[1], 0);
|
||||
ZBarcode_Print(symbol, 0);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1761,10 +1761,10 @@ function as shown in the next example:
|
||||
#include <zint.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
ZBarcode_Encode_and_Print(symbol, argv[1], 0, 0);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1845,13 +1845,13 @@ client application:
|
||||
|
||||
int row, col, i = 0, j = 0;
|
||||
|
||||
for (row = 0; row < my_symbol->bitmap_height; row++) {
|
||||
for (col = 0; col < my_symbol->bitmap_width; col++) {
|
||||
int red = (int) my_symbol->bitmap[i];
|
||||
int green = (int) my_symbol->bitmap[i + 1];
|
||||
int blue = (int) my_symbol->bitmap[i + 2];
|
||||
if (my_symbol->alphamap) {
|
||||
int alpha = (int) my_symbol->alphamap[j];
|
||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||
for (col = 0; col < symbol->bitmap_width; col++) {
|
||||
int red = (int) symbol->bitmap[i];
|
||||
int green = (int) symbol->bitmap[i + 1];
|
||||
int blue = (int) symbol->bitmap[i + 2];
|
||||
if (symbol->alphamap) {
|
||||
int alpha = (int) symbol->alphamap[j];
|
||||
render_rgba(row, col, red, green, blue, alpha);
|
||||
j++;
|
||||
} else {
|
||||
@@ -1871,9 +1871,9 @@ loop for accessing the data is then:
|
||||
|
||||
int row, col, i = 0;
|
||||
|
||||
for (row = 0; row < my_symbol->bitmap_height; row++) {
|
||||
for (col = 0; col < my_symbol->bitmap_width; col++) {
|
||||
render_pixel(row, col, my_symbol->bitmap[i]);
|
||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||
for (col = 0; col < symbol->bitmap_width; col++) {
|
||||
render_pixel(row, col, symbol->bitmap[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -1905,23 +1905,23 @@ draw_string(), and draw_circle() routines available:
|
||||
struct zint_vector_string *string;
|
||||
struct zint_vector_circle *circle;
|
||||
|
||||
prepare_canvas(my_symbol->vector->width, my_symbol->vector->height,
|
||||
my_symbol->scale, my_symbol->fgcolour, my_symbol->bgcolour,
|
||||
prepare_canvas(symbol->vector->width, symbol->vector->height,
|
||||
symbol->scale, symbol->fgcolour, symbol->bgcolour,
|
||||
rotate_angle);
|
||||
|
||||
for (rect = my_symbol->vector->rectangles; rect; rect = rect->next) {
|
||||
for (rect = symbol->vector->rectangles; rect; rect = rect->next) {
|
||||
draw_rect(rect->x, rect->y, rect->width, rect->height,
|
||||
rect->colour);
|
||||
}
|
||||
for (hex = my_symbol->vector->hexagons; hex; hex = hex->next) {
|
||||
for (hex = symbol->vector->hexagons; hex; hex = hex->next) {
|
||||
draw_hexagon(hex->x, hex->y, hex->diameter, hex->rotation);
|
||||
}
|
||||
for (string = my_symbol->vector->strings; string; string = string->next) {
|
||||
for (string = symbol->vector->strings; string; string = string->next) {
|
||||
draw_string(string->x, string->y, string->fsize,
|
||||
string->rotation, string->halign,
|
||||
string->text, string->length);
|
||||
}
|
||||
for (circle = my_symbol->vector->circles; circle; circle = circle->next) {
|
||||
for (circle = symbol->vector->circles; circle; circle = circle->next) {
|
||||
draw_circle(circle->x, circle->y, circle->diameter, circle->width);
|
||||
}
|
||||
|
||||
@@ -1937,15 +1937,15 @@ the buffer is given in memfile_size. For instance:
|
||||
#include <string.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
my_symbol->output_options |= BARCODE_MEMORY_FILE;
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
symbol->output_options |= BARCODE_MEMORY_FILE;
|
||||
/* Only the extension is used, to determine output format */
|
||||
strcpy(my_symbol->outfile, "mem.svg");
|
||||
ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0);
|
||||
/* `my_symbol->memfile` now contains the SVG output */
|
||||
fwrite(my_symbol->memfile, 1, my_symbol->memfile_size, stdout);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
strcpy(symbol->outfile, "mem.svg");
|
||||
ZBarcode_Encode_and_Print(symbol, argv[1], 0, 0);
|
||||
/* `symbol->memfile` now contains the SVG output */
|
||||
fwrite(symbol->memfile, 1, symbol->memfile_size, stdout);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2082,14 +2082,6 @@ the following members:
|
||||
width integer Width of the generated (output only)
|
||||
symbol.
|
||||
|
||||
encoded_data array of Representation of the (output only)
|
||||
unsigned encoded data.
|
||||
character
|
||||
arrays
|
||||
|
||||
row_height array of Heights of each row. (output only)
|
||||
floats
|
||||
|
||||
errtxt character Error message in the event (output only)
|
||||
string that an error occurred,
|
||||
with a terminating NUL -
|
||||
@@ -2130,13 +2122,22 @@ the following members:
|
||||
memfile_size integer Length of in-memory file (output only)
|
||||
buffer.
|
||||
|
||||
raw_segs pointer to Pointer to array of raw (output only)
|
||||
array of segments if
|
||||
segments BARCODE_RAW_TEXT set in
|
||||
output_options - see 5.16
|
||||
Feedback.
|
||||
content_segs pointer to Pointer to array of (output only)
|
||||
array of content segments if
|
||||
segments BARCODE_CONTENT_SEGS set
|
||||
in output_options - see
|
||||
5.16 Feedback.
|
||||
|
||||
raw_seg_count integer Number of raw segments. (output only)
|
||||
content_seg_count integer Number of content (output only)
|
||||
segments.
|
||||
|
||||
encoded_data array of Representation of the (output only)
|
||||
unsigned encoded data.
|
||||
character
|
||||
arrays
|
||||
|
||||
row_height array of Heights of each row. (output only)
|
||||
floats
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Table 12: API Structure zint_symbol
|
||||
@@ -2149,12 +2150,12 @@ plotted in green.
|
||||
#include <string.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
strcpy(my_symbol->fgcolour, "00ff00");
|
||||
my_symbol->height = 400.0f;
|
||||
ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
strcpy(symbol->fgcolour, "00ff00");
|
||||
symbol->height = 400.0f;
|
||||
ZBarcode_Encode_and_Print(symbol, argv[1], 0, 0);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2162,7 +2163,7 @@ Note that background removal for all outputs except BMP can be achieved by
|
||||
setting the background alpha to "00" where the values for R, G and B will be
|
||||
ignored:
|
||||
|
||||
strcpy(my_symbol->bgcolour, "55555500");
|
||||
strcpy(symbol->bgcolour, "55555500");
|
||||
|
||||
This is what the CLI option --nobackground does - see 4.7 Using Colour.
|
||||
|
||||
@@ -2247,23 +2248,23 @@ To catch errors use an integer variable as shown in the code below:
|
||||
#include <string.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct zint_symbol *my_symbol;
|
||||
struct zint_symbol *symbol;
|
||||
int error;
|
||||
my_symbol = ZBarcode_Create();
|
||||
symbol = ZBarcode_Create();
|
||||
/* Set invalid foreground colour */
|
||||
strcpy(my_symbol->fgcolour, "nonsense");
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0);
|
||||
strcpy(symbol->fgcolour, "nonsense");
|
||||
error = ZBarcode_Encode_and_Print(symbol, argv[1], 0, 0);
|
||||
if (error != 0) {
|
||||
/* Some warning or error occurred */
|
||||
printf("%s\n", my_symbol->errtxt);
|
||||
printf("%s\n", symbol->errtxt);
|
||||
if (error >= ZINT_ERROR) {
|
||||
/* Stop now */
|
||||
ZBarcode_Delete(my_symbol);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* Otherwise carry on with the rest of the application */
|
||||
ZBarcode_Delete(my_symbol);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2286,7 +2287,7 @@ The output_options member can be used to adjust various aspects of the output
|
||||
file. To select more than one option from the table below simply OR them
|
||||
together when adjusting this value:
|
||||
|
||||
my_symbol->output_options |= BARCODE_BIND | READER_INIT;
|
||||
symbol->output_options |= BARCODE_BIND | READER_INIT;
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Value Effect
|
||||
@@ -2339,8 +2340,8 @@ together when adjusting this value:
|
||||
BARCODE_MEMORY_FILE Write output to in-memory buffer symbol->memfile
|
||||
instead of to outfile file.
|
||||
|
||||
BARCODE_RAW_TEXT Write data encoded to raw segment buffers
|
||||
symbol->raw_segs (see 5.16 Feedback).
|
||||
BARCODE_CONTENT_SEGS Write data encoded to content segment buffers
|
||||
symbol->contentsegs (see 5.16 Feedback).
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Table 14: API output_options Values
|
||||
@@ -2397,15 +2398,15 @@ ESCAPE_MODE, GS1PARENS_MODE, GS1NOCHECK_MODE, HEIGHTPERROW_MODE, FAST_MODE,
|
||||
EXTRA_ESCAPE_MODE and GS1SYNTAXENGINE_MODE are optional. So, for example, you
|
||||
can set
|
||||
|
||||
my_symbol->input_mode = UNICODE_MODE | ESCAPE_MODE;
|
||||
symbol->input_mode = UNICODE_MODE | ESCAPE_MODE;
|
||||
|
||||
or
|
||||
|
||||
my_symbol->input_mode = GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE;
|
||||
symbol->input_mode = GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE;
|
||||
|
||||
whereas
|
||||
|
||||
my_symbol->input_mode = DATA_MODE | GS1_MODE;
|
||||
symbol->input_mode = DATA_MODE | GS1_MODE;
|
||||
|
||||
is not valid.
|
||||
|
||||
@@ -2477,13 +2478,13 @@ example:
|
||||
{ "Текст", 0, 7 },
|
||||
{ "文章", 0, 20 }
|
||||
};
|
||||
struct zint_symbol *my_symbol;
|
||||
my_symbol = ZBarcode_Create();
|
||||
my_symbol->symbology = BARCODE_AZTEC;
|
||||
my_symbol->input_mode = UNICODE_MODE;
|
||||
ZBarcode_Encode_Segs(my_symbol, segs, 3);
|
||||
ZBarcode_Print(my_symbol, 0);
|
||||
ZBarcode_Delete(my_symbol);
|
||||
struct zint_symbol *symbol;
|
||||
symbol = ZBarcode_Create();
|
||||
symbol->symbology = BARCODE_AZTEC;
|
||||
symbol->input_mode = UNICODE_MODE;
|
||||
ZBarcode_Encode_Segs(symbol, segs, 3);
|
||||
ZBarcode_Print(symbol, 0);
|
||||
ZBarcode_Delete(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2515,12 +2516,12 @@ rounded to half-integer increments.
|
||||
For example:
|
||||
|
||||
/* Royal Mail 4-State Customer Code */
|
||||
my_symbol->symbology = BARCODE_RM4SCC;
|
||||
my_symbol->dpmm = 600.0f / 25.4f; /* 600 dpi */
|
||||
my_symbol->scale = ZBarcode_Scale_From_XdimDp(
|
||||
my_symbol->symbology,
|
||||
ZBarcode_Default_Xdim(my_symbol->symbology),
|
||||
my_symbol->dpmm, "PNG"); /* Returns 7.5 */
|
||||
symbol->symbology = BARCODE_RM4SCC;
|
||||
symbol->dpmm = 600.0f / 25.4f; /* 600 dpi */
|
||||
symbol->scale = ZBarcode_Scale_From_XdimDp(
|
||||
symbol->symbology,
|
||||
ZBarcode_Default_Xdim(symbol->symbology),
|
||||
symbol->dpmm, "PNG"); /* Returns 7.5 */
|
||||
|
||||
The third function ZBarcode_XdimDP_From_Scale() is the “reverse” of
|
||||
ZBarcode_Scale_From_XdimDp(), returning the X-dimension (in mm) or the dot
|
||||
@@ -2648,10 +2649,10 @@ codewords and -1 meaning minimum 3 codewords). Micro PDF417 also will return the
|
||||
ECC percentage in option_1 as P << 8.
|
||||
|
||||
Detailed feedback on the data encoded may be requested by specifying the
|
||||
BARCODE_RAW_TEXT option in the output_options member, which will populate the
|
||||
raw_segs member with an array of zint_seg structures (see 5.12 Multiple Segments
|
||||
for the format), one for each segment specified, the size of the array being set
|
||||
in raw_seg_count - which will always be at least one.
|
||||
BARCODE_CONTENT_SEGS option in the output_options member, which will populate
|
||||
the content_segs member with an array of zint_seg structures (see 5.12 Multiple
|
||||
Segments for the format), one for each segment specified, the size of the array
|
||||
being set in content_seg_count - which will always be at least one.
|
||||
|
||||
The source, length and eci members of zint_seg will be set accordingly - the
|
||||
unconverted data in source, the data length in length, and the character set the
|
||||
@@ -2843,19 +2844,19 @@ case Zint will verify the check digit, or you may use symbology BARCODE_UPCA_CHK
|
||||
digits will be zero-filled.
|
||||
|
||||
In addition 2-digit and 5-digit add-on symbols can be added, their data
|
||||
separated from the main data by a + character or a space. For example, to draw a
|
||||
UPC-A symbol with the data “72527270270” and 5-digit add-on data “12345” use the
|
||||
command:
|
||||
separated from the main data by a '+' character or a space. For example, to draw
|
||||
a UPC-A symbol with the data “72527270270” and 5-digit add-on data “12345” use
|
||||
the command:
|
||||
|
||||
zint -b UPCA -d "72527270270+12345"
|
||||
|
||||
or using the API:
|
||||
|
||||
my_symbol->symbology = BARCODE_UPCA;
|
||||
symbol->symbology = BARCODE_UPCA;
|
||||
/* Using '+' */
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, "72527270270+12345", 0, 0);
|
||||
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0);
|
||||
/* Or a space */
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, "72527270270 12345", 0, 0);
|
||||
error = ZBarcode_Encode_and_Print(symbol, "72527270270 12345", 0, 0);
|
||||
|
||||
[zint -b UPCA --compliantheight -d "72527270270+12345"]
|
||||
|
||||
@@ -2867,9 +2868,9 @@ there is an add-on:
|
||||
|
||||
or using the API:
|
||||
|
||||
my_symbol->symbology = BARCODE_UPCA;
|
||||
my_symbol->output_options |= EANUPC_GUARD_WHITESPACE;
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, "72527270270+12345", 0, 0);
|
||||
symbol->symbology = BARCODE_UPCA;
|
||||
symbol->output_options |= EANUPC_GUARD_WHITESPACE;
|
||||
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0);
|
||||
|
||||
[zint -b UPCA --compliantheight -d "72527270270+12345" --guardwhitespace]
|
||||
|
||||
@@ -2893,7 +2894,7 @@ An 8-digit input including the check digit may also be supplied, in which case
|
||||
Zint will verify the check digit, or the symbology BARCODE_UPCE_CHK (38) may be
|
||||
used, which will verify that the last digit is a check digit before encoding.
|
||||
|
||||
As with UPC-A, 2-digit and 5-digit add-on symbols can be added using a +
|
||||
As with UPC-A, 2-digit and 5-digit add-on symbols can be added using a '+'
|
||||
character or a space as a separator, and a quiet zone indicator can be added
|
||||
when there is an add-on by setting --guardwhitespace (API
|
||||
output_options |= EANUPC_GUARD_WHITESPACE):
|
||||
@@ -2934,8 +2935,8 @@ with UPC symbols. For example:
|
||||
will encode an EAN-13 symbol with a 2-digit add-on. As before these results can
|
||||
be achieved using the API:
|
||||
|
||||
my_symbol->symbology = BARCODE_EAN13;
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, "451234567890+21", 0, 0);
|
||||
symbol->symbology = BARCODE_EAN13;
|
||||
error = ZBarcode_Encode_and_Print(symbol, "451234567890+21", 0, 0);
|
||||
|
||||
[zint -b EAN13 --compliantheight -d "451234567890+21"]
|
||||
|
||||
@@ -2966,9 +2967,9 @@ are the same as for 6.1.3.2 UPC Version E. For instance:
|
||||
|
||||
or using the API:
|
||||
|
||||
my_symbol->symbology = BARCODE_EAN8;
|
||||
my_symbol->output_options |= EANUPC_GUARD_WHITESPACE;
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, "7432365", 0, 0);
|
||||
symbol->symbology = BARCODE_EAN8;
|
||||
symbol->output_options |= EANUPC_GUARD_WHITESPACE;
|
||||
error = ZBarcode_Encode_and_Print(symbol, "7432365", 0, 0);
|
||||
|
||||
[zint -b EAN8 --compliantheight -d "7432365" –guardwhitespace]
|
||||
|
||||
@@ -3008,9 +3009,9 @@ As with the main EAN/UPC symbols a quiet zone indicator can be added using
|
||||
will generate a standalone 5-digit add-on with quiet zone guards, or using the
|
||||
API:
|
||||
|
||||
my_symbol->symbology = BARCODE_EAN_5ADDON;
|
||||
my_symbol->output_options |= EANUPC_GUARD_WHITESPACE;
|
||||
error = ZBarcode_Encode_and_Print(my_symbol, "54321", 0, 0);
|
||||
symbol->symbology = BARCODE_EAN_5ADDON;
|
||||
symbol->output_options |= EANUPC_GUARD_WHITESPACE;
|
||||
error = ZBarcode_Encode_and_Print(symbol, "54321", 0, 0);
|
||||
|
||||
[zint -b EAN_5ADDON --compliantheight -d "54321" –guardwhitespace]
|
||||
|
||||
@@ -3464,10 +3465,10 @@ will draw two Code 128 symbols, one on top of the other. The same result can be
|
||||
achieved using the API by executing the ZBarcode_Encode() function more than
|
||||
once on a symbol. For example:
|
||||
|
||||
my_symbol->symbology = BARCODE_CODE128;
|
||||
error = ZBarcode_Encode(my_symbol, "This", 0);
|
||||
error = ZBarcode_Encode(my_symbol, "That", 0);
|
||||
error = ZBarcode_Print(my_symbol);
|
||||
symbol->symbology = BARCODE_CODE128;
|
||||
error = ZBarcode_Encode(symbol, "This", 0);
|
||||
error = ZBarcode_Encode(symbol, "That", 0);
|
||||
error = ZBarcode_Print(symbol);
|
||||
|
||||
[zint -d "This" -d "That"]
|
||||
|
||||
@@ -3561,11 +3562,12 @@ above.
|
||||
6.2.6 MicroPDF417 (ISO 24728)
|
||||
|
||||
A variation of the PDF417 standard, MicroPDF417 is intended for applications
|
||||
where symbol size needs to be kept to a minimum. 34 predefined symbol sizes are
|
||||
available with 1 - 4 columns and 4 - 44 rows. The maximum amount a MicroPDF417
|
||||
symbol can hold is 250 alphanumeric characters or 366 digits. The amount of
|
||||
error correction used is dependent on symbol size. The number of columns used
|
||||
can be determined using the --cols switch (API option_2) as with PDF417.
|
||||
where symbol size needs to be kept to a minimum. Its size ranges over 1 - 4 data
|
||||
columns and 4 - 44 rows. The maximum amount a MicroPDF417 symbol can hold is 250
|
||||
alphanumeric characters or 366 digits. The amount of error correction used is
|
||||
dependent on symbol size. The number of data columns used can be determined
|
||||
using the --cols switch (API option_2) as with PDF417. The amount of data
|
||||
determines the number of rows.
|
||||
|
||||
[zint -b MICROPDF417 -d "12345678"]
|
||||
|
||||
@@ -3694,13 +3696,13 @@ This creates an EAN-13 linear component with the data "331234567890" and a 2D
|
||||
CC-A (see below) component with the data "(99)1234-abcd". The same results can
|
||||
be achieved using the API as shown below:
|
||||
|
||||
my_symbol->symbology = BARCODE_EAN13_CC;
|
||||
my_symbol->option_1 = 1;
|
||||
strcpy(my_symbol->primary, "331234567890");
|
||||
ZBarcode_Encode_and_Print(my_symbol, "[99]1234-abcd", 0, 0);
|
||||
symbol->symbology = BARCODE_EAN13_CC;
|
||||
symbol->option_1 = 1;
|
||||
strcpy(symbol->primary, "331234567890");
|
||||
ZBarcode_Encode_and_Print(symbol, "[99]1234-abcd", 0, 0);
|
||||
|
||||
2-digit and 5-digit add-on data can be used with EAN and UPC symbols using the +
|
||||
character as described in sections 6.1.3 UPC (Universal Product Code) (ISO
|
||||
2-digit and 5-digit add-on data can be used with EAN and UPC symbols using the
|
||||
'+' character as described in sections 6.1.3 UPC (Universal Product Code) (ISO
|
||||
15420) and 6.1.4 EAN (European Article Number) (ISO 15420).
|
||||
|
||||
The 2D component of a composite symbol can use one of three systems: CC-A, CC-B
|
||||
@@ -5097,7 +5099,7 @@ configured barcode is updated when the "Generate" button is pressed.
|
||||
|
||||
Annex D. Man Page ZINT(1)
|
||||
|
||||
% ZINT(1) Version 2.15.0.9 % % October 2025
|
||||
% ZINT(1) Version 2.15.0.9 % % November 2025
|
||||
|
||||
NAME
|
||||
|
||||
@@ -5846,7 +5848,7 @@ Edge Barcode and Flattermarken. Note that HRT is never shown for stacked and
|
||||
matrix barcodes.
|
||||
|
||||
[7] Shift JIS (JIS X 0201 Roman) re-maps two ASCII characters: backslash (\) to
|
||||
the yen sign (¥), and tilde (~) to overline (U+203E).
|
||||
the yen sign (¥), and tilde (~) to overline (‾, U+203E).
|
||||
|
||||
[8] ISO/IEC 646 Invariant is a subset of ASCII with 12 characters undefined: #,
|
||||
$, @, [, \, ], ^, `, {, |, }, ~ (tilde).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" Automatically generated by Pandoc 3.8.2
|
||||
.\" Automatically generated by Pandoc 3.8.2.1
|
||||
.\"
|
||||
.TH "ZINT" "1" "October 2025" "Version 2.15.0.9"
|
||||
.TH "ZINT" "1" "November 2025" "Version 2.15.0.9"
|
||||
.SH NAME
|
||||
\f[CR]zint\f[R] \- encode data as a barcode image
|
||||
.SH SYNOPSIS
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% ZINT(1) Version 2.15.0.9
|
||||
%
|
||||
% October 2025
|
||||
% November 2025
|
||||
|
||||
# NAME
|
||||
|
||||
|
||||
Reference in New Issue
Block a user