This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/includes/jpgraph/docs/chunkhtml/ch25.html
2011-05-28 19:51:52 +10:00

178 lines
17 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 25. PDF417 (2D-Barcode)</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="pt06.html" title="Part VI. Barcodes"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 25. PDF417 (2D-Barcode)</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Part VI. Barcodes</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="chapter" title="Chapter 25. PDF417 (2D-Barcode)"><div class="titlepage"><div><div><h2 class="title"><a name="chap.pdf417"></a>Chapter 25. PDF417 (2D-Barcode)</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch25.html#id2599362">25.1. Principle of PDF417 Barcodes</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch25.html#id2599518">25.1.1. PDF417 standard</a></span></dt><dt><span class="sect2"><a href="ch25.html#id2599540">25.1.2. Data capacity</a></span></dt><dt><span class="sect2"><a href="ch25.html#id2599627">25.1.3. Structure of PDF417 barcodes</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch25s02.html">25.2. Creating barcodes</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch25s02.html#id2599905">25.2.1. Introduction</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch25s03.html">25.3. Creating barcodes</a></span></dt><dt><span class="sect1"><a href="ch25s04.html">25.4. Specifying the PDF417 parameters</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch25s04.html#id2600768">25.4.1. Specifying encoding and input data</a></span></dt><dt><span class="sect2"><a href="ch25s04.html#id2601186">25.4.2. Encoder option: Adjusting the number of data columns</a></span></dt><dt><span class="sect2"><a href="ch25s04.html#id2601209">25.4.3. Encoder option: Adjusting the error level</a></span></dt><dt><span class="sect2"><a href="ch25s04.html#id2601957">25.4.4. Truncated PDF417</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch25s05.html">25.5. Adjusting the output</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch25s05.html#id2602136">25.5.1. Output format</a></span></dt><dt><span class="sect2"><a href="ch25s05.html#id2602186">25.5.2. Summary of user settings for the backend</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch25s06.html">25.6. A template to create barcodes</a></span></dt><dt><span class="sect1"><a href="ch25s07.html">25.7. Method reference</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch25s07.html#id2602322">25.7.1. Encoder methods</a></span></dt><dt><span class="sect2"><a href="ch25s07.html#id2602572">25.7.2. Common backend methods</a></span></dt><dt><span class="sect2"><a href="ch25s07.html#id2603037">25.7.3. Image backend methods</a></span></dt><dt><span class="sect2"><a href="ch25s07.html#id2603084">25.7.4. Postscript backend methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch25s08.html">25.8. Example scripts</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch25s08.html#id2603211">25.8.1. Showing human readable text</a></span></dt><dt><span class="sect2"><a href="ch25s08.html#id2603267">25.8.2. Altering colors</a></span></dt><dt><span class="sect2"><a href="ch25s08.html#id2603338">25.8.3. Creating postscript output</a></span></dt><dt><span class="sect2"><a href="ch25s08.html#id2603350">25.8.4. Manually selecting compaction schema</a></span></dt></dl></dd></dl></div>
<div class="sect1" title="Principle of PDF417 Barcodes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2599362"></a>Principle of PDF417 Barcodes</h2></div></div></div>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3>
<p>This module is only available in the pro-version of the library.</p>
</div>
<p>
</p><div class="caution" title="Caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3>
<p>In order to use the PDF417 barcode module it is necessary for the PHP
installation to support the function <span class="command"><strong>bcmod()</strong></span>. This is enabled
when compiling PHP by making sure that the option <code class="code">--enable-bcmath</code>
is given when configuring PHP at compile time.</p>
</div><p>
</p>
<p>This first section gives a very brief explanation of the general structure of PDF417
barcodes and some capacity figures. </p>
<p>PDF417 was one of the first publicly available high density (capable of storing up to
2710 data characters) two dimensional barcodes. It was originally published by Symbol
Technologies, Inc. but has since become an ISO standard. PDF417 belongs to the early two
dimensional barcodes which internally consists of a number of linear barcodes stacked on
top of each other. This is in contrast to the more modern two dimensional barcodes like
<span class="italic">Datamatrix</span> and <span class="italic">QR
code</span> which are truly two dimensional in that they have moved away from
the row thinking in the internal construction of the barcode.</p>
<p>PDDF417 barcodes are extensively used for example within aviation, automobile industry
and health care. </p>
<p>Strictly speaking it is not necessary to know this level of detail to use the PDF417
barcode module but we would recommend to read through this at least once since some
parameters (like number of columns - explained below - that are used adjustable)</p>
<p>PDF417 is an acronym for <span class="italic"><span class="bold"><strong>P</strong></span>ortable <span class="bold"><strong>D</strong></span>ata <span class="bold"><strong>F</strong></span>ormat 4 of 17</span> where 4 of 17 describes the structure of
how a single data character is encoded (4 bars and 4 spaces in a 17 module wide
structure).</p>
<div class="sect2" title="PDF417 standard"><div class="titlepage"><div><div><h3 class="title"><a name="id2599518"></a>PDF417 standard</h3></div></div></div>
<p>The PDF417 is high capacity two dimensional barcode and is fully described in the
official standard ISO/IEC 15438:2001 available for purchase from <code class="uri"><a class="uri" href="http://www.iso.ch/iso/en/CombinedQueryResult.CombinedQueryResult?queryString=pdf417" target="_top">ISO Standard Organization</a></code>. </p>
</div>
<div class="sect2" title="Data capacity"><div class="titlepage"><div><div><h3 class="title"><a name="id2599540"></a>Data capacity</h3></div></div></div>
<p>PDF417 is a row based 2 dimensional barcode that consists of a maximum of 90 rows
and 30 columns. The maximum number of data is dependent on </p>
<p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p>The compaction mode used</p>
</li><li class="listitem">
<p>The number of columns (and rows)</p>
</li><li class="listitem">
<p>The error correction level</p>
</li></ul></div><p>
</p>
<p>The maximum data size is dependent on both the compaction mode as well as the
input data. The figures listed below will give some idea on the capacity</p>
<p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p>2710 digits in numeric compaction mode</p>
</li><li class="listitem">
<p>1850 characters in text compaction mode</p>
</li><li class="listitem">
<p>1108 bytes in byte compaction mode</p>
</li></ul></div><p>
</p>
<p>One barcode can hold up to a maximum of 929 codewords (data count + data + error
correction)</p>
</div>
<div class="sect2" title="Structure of PDF417 barcodes"><div class="titlepage"><div><div><h3 class="title"><a name="id2599627"></a>Structure of PDF417 barcodes</h3></div></div></div>
<p>A high level overview of the structure of a PDF417 barcode is shown in <a class="xref" href="ch25.html#fig.pdf417-structure-overview" title="Figure 25.1. PDF417 Structure - Overview">Figure 25.1. PDF417 Structure - Overview</a> . A PDF417 barcode can be thought
of as a number of linear barcode stapled on top of each other. Each row in the
barcode is constructed in a similar way.</p>
<p>Each data word (symbol character) consists of 4 bars and four spaces in a 17
module structure, hence the name PDF417. A more detailed explanation of a real
PDF417 barcode is shown in <a class="xref" href="ch25.html#fig.pdf417-structure-details" title="Figure 25.2. PDF417 Structure - Details of a real barcode">Figure 25.2. PDF417 Structure - Details of a real barcode</a></p>
<p>There are three distinct areas in a barcode:</p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p><span class="bold"><strong>Start and stop pattern (light red background
color)</strong></span>. Used to help the scanner find the start and
beginning of the barcode. These patterns are static and are the same for
all barcodes.</p>
</li><li class="listitem">
<p><span class="bold"><strong>Left and right row indicators</strong></span>. Used
to help the scanner orient itself in the barcode. These patterns are
dependent on the actual data in the barcode to achieve maximum
contrast.</p>
</li><li class="listitem">
<p><span class="bold"><strong>Data and data count</strong></span>. This is unique
for each barcode and represents the encoded data. PDF417 specifies
several ways to encode the characters in the input data to achieve
maximum compression level based on the knowledge (and restriction) on
the input alphabet. For example, if the data is known to be only numeric
the encodation can take advantage of this and make the compaction schema
more efficient than if also alphabetical letters have to be encoded. </p>
<p>The way the data is encoded is user specifiable. By default the
library analyses the input data and determines an optimal mix of
encoding suitable for this particular data.</p>
</li><li class="listitem">
<p><span class="bold"><strong>Error correction codewords</strong></span>. Each
PDf417 have a user selectable error correction level. Since the barcode
have a specified size this means that the more error correction words
that are used the less data can fit. The error correction words are
added to the end of the payload data, each barcode has a minimum of 2
error detection codewords. Up to 510 additional error correction
codewords can be added for maximum data correction.</p>
</li></ol></div><p>
</p>
<p>
</p><div class="figure"><a name="fig.pdf417-structure-overview"></a><p class="title"><b>Figure 25.1. PDF417 Structure - Overview</b></p><div class="figure-contents">
<div class="mediaobject"><img src="images/pdf417-structure-overview-smaller.png" alt="PDF417 Structure - Overview"></div>
</div></div><p><br class="figure-break">
</p>
<p>In <a class="xref" href="ch25.html#fig.pdf417-structure-details" title="Figure 25.2. PDF417 Structure - Details of a real barcode">Figure 25.2. PDF417 Structure - Details of a real barcode</a> the distinct data column
(which on each row holds one data word) are indicated at the bottom
(w1,w2,w3,w4,w5). This particular barcode have 8 rows and 5 columns which means that
the total number of data words + error correction words encoded are 8x5 = 40.</p>
<p>
</p><div class="figure"><a name="fig.pdf417-structure-details"></a><p class="title"><b>Figure 25.2. PDF417 Structure - Details of a real barcode</b></p><div class="figure-contents">
<div class="mediaobject"><img src="images/pdf417-structure-details.png" alt="PDF417 Structure - Details of a real barcode"></div>
</div></div><p><br class="figure-break">
</p>
<p>The data to be converted into a barcode has to go through a number of steps which
are handled by the library:</p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>The first step is a high level compression schema known as compaction.
This schema translates the input string into a number of codewords. Each
codeword has a numeric value between 0 and 928. To achieve the highest
possible compaction and flexibility the PDF417 standard defined three
different compaction schema:</p>
<p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p>numeric (encodes only digits 0-9, ASCII 30-39). This
schema can compact up to 2.9 digits per codeword (and has
the highest density)</p>
</li><li class="listitem">
<p>byte (encodes ASCII 0-255). This schema can only compact
up to 1.2 bytes per codeword (and has the lowest
density)</p>
</li><li class="listitem">
<p>text (which encodes ASCII 32-126). This schema can compact
up to 1.8 characters per codeword.</p>
</li></ul></div><p>
</p>
</li><li class="listitem">
<p>The second step is the transformation of codeword into (4,17) symbols.
The exact symbol used is dependent on which row the codeword to be
encoded is on. Three different sets of codewords, known as clusters, are
used. This ensures that two adjacent rows uses different clusters. This
allows the barcode to be scanned without using specific divider
symbols.</p>
</li><li class="listitem">
<p>In the third step the error codewords specified are calculated and
added to the end of the payload data. The error correction uses
polynomial Reed-Solomon error correcting coding (same schema as used on
CD:s) to achieve a good balance between error correcting efficiency and
computational effort and space requirements. </p>
</li><li class="listitem">
<p>Finally these codeword are positioned sequentially in each row
starting at the top left corner down to the bottom right in between the
left and right row indicators, and the start and stop patterns.</p>
</li></ol></div><p>
</p>
<p>By necessity this s a fairly shallow description where we have omitted many
technical details in the encodation process. We therefore refer to the official
standard which gives much more technical details on the encodation process. </p>
</div>
</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="pt06.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>