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/ch33.html
2011-05-28 19:51:52 +10:00

283 lines
29 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 33. USPS Confirmation Barcodes</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="pt08.html" title="Part VIII. Case studies"></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 33. USPS Confirmation Barcodes</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Part VIII. Case studies</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="chapter" title="Chapter 33. USPS Confirmation Barcodes"><div class="titlepage"><div><div><h2 class="title"><a name="id2620047"></a>Chapter 33. USPS Confirmation Barcodes</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch33.html#id2620134">33.1. Creating the confirmation codes</a></span></dt></dl></div>
<p>US Postal Service (USPS) uses EAN-128 barcodes to tag confirmation codes for the
sender of parcels and letters in the case the sender is a registered business entity.
The confirmation barcode gives feedback to the sender on the date, ZIP Code and the time
the article was delivered. </p>
<div class="figure"><a name="id2620090"></a><p class="title"><b>Figure 33.1. usps_exhibit44.png</b></p><div class="figure-contents">
<div class="mediaobject"><img src="images/usps_exhibit44.png" alt="usps_exhibit44.png"></div>
</div></div><br class="figure-break">
<p>The full standard describing this is available in "<code class="uri"><a class="uri" href="http://www.usps.com/cpim/ftp/pubs/pub91/welcome.htm" target="_top">Confirmation
Services Technical Guide</a></code>" </p>
<p>In order to create labels adhering to this strict standard it is possible to use
JpGraph as a basic building block in order to create the barcode part (which uses
UCC/EAN128 as mandatory coding from 2004 and onwards). The standard describes two basic
forms of labels :</p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>Inclusion of postal service routing information (destination ZIP code)
</p>
</li><li class="listitem">
<p>Exclusion of the destination ZIP code. This will then only include the Dun
&amp; Bradstreet Number (DUNS). The DUNS uniquely identifies businesses at
specific geographical locations. For more information regarding this and how
to obtain such a number please refer to USPS technical documentation.
</p>
</li></ol></div><p>
</p>
<div class="sect1" title="Creating the confirmation codes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2620134"></a>Creating the confirmation codes</h2></div></div></div>
<p>In order to create the final Package Identification Code (PIC) the following three
steps must be taken </p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>Determine the basic element of the code. This consists of identifying
the Zip code (of the addressee), USPS service type, the DUNS and
Sequence number of parcel (as determined by the business). These number
are input and the process of how to get those number is not described
further in this short note. It is assumed that a potential client will
now how these numbers are obtained. </p>
</li><li class="listitem">
<p>Determine what type of confirmation code should be used (with or
without Zip code) </p>
</li><li class="listitem">
<p>Calculate the additional checkdigit for the code and append that code
to the digit sequence. </p>
</li></ol></div><p>
</p>
<p>The final code that one arrives at in the final stage is then the barcode that
should be created. However creating this code requires knowledge of the EAN-128
barcode format and the rules for creating barcodes that follow the highly
standardized format for a EAN-128 barcode. </p>
<p>EAN-128 barcodes are the same as CODE-128 barcodes from a technical barcode point
of view but the data to be encoded must follow a rigorous standard. The JpGraph
library has built in validation to ensure that any data that is encoded using the
EAN-128 symbology follows this standard. </p>
<p>This standard requires that special control character is inserted at specific
points in the data stream. In the discussion below we will simply state what those
control characters are and not discuss the general format of the EAN-128 barcodes in
too much details. </p>
<p>In order to do this we will create a utility class with methods that does the
following three things </p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>Create the additional USPS Modulo-10 check digit. </p>
</li><li class="listitem">
<p>Create a confirmation code without the ZIP number </p>
</li><li class="listitem">
<p>Create a confirmation code with ZIP number </p>
</li></ol></div><p>
</p>
<p><span class="bold"><strong>The USPS_Confirmation Utility class</strong></span></p>
<p>For both types of confirmation code USPS uses its own checkdigit (a variant of a
Modulo-10 checkdigit) at the end of the complete Package Identification Code (PIC),
(the exact process for calculating this number is also described in the technical
documentation released by USPS). The utility class will therefore consist of three
methods, one to calculate the checkdigit and one method each to create PIC with and
without ZIP code. The three methods are listed below </p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p><span class="bold"><strong><code class="code">function
_USPS_chkd($aData)</code></strong></span></p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags">&lt;?php</span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> Calculate the single digit check digit from sequence of numbers</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> in a string</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">_USPS_chkd</span><span class="hl-brackets">(</span><span class="hl-var">$aData</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
</span><span class="hl-var">$n</span><span class="hl-code"> = </span><span class="hl-identifier">strlen</span><span class="hl-brackets">(</span><span class="hl-var">$aData</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Add all numbers at position 0,2,4,.. from the end</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$et</span><span class="hl-code"> = </span><span class="hl-number">0</span><span class="hl-code"> ;
</span><span class="hl-reserved">for</span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-var">$i</span><span class="hl-code">=</span><span class="hl-number">1</span><span class="hl-code">; </span><span class="hl-var">$i</span><span class="hl-code"> &lt;= </span><span class="hl-var">$n</span><span class="hl-code">; </span><span class="hl-var">$i</span><span class="hl-code">+=</span><span class="hl-number">2</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
</span><span class="hl-var">$d</span><span class="hl-code"> = </span><span class="hl-identifier">intval</span><span class="hl-brackets">(</span><span class="hl-identifier">substr</span><span class="hl-brackets">(</span><span class="hl-var">$aData</span><span class="hl-code">,-</span><span class="hl-var">$i</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$et</span><span class="hl-code"> += </span><span class="hl-var">$d</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> Add all numbers at position 1,3,5,... from the end</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$ot</span><span class="hl-code"> = </span><span class="hl-number">0</span><span class="hl-code"> ;
</span><span class="hl-reserved">for</span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-var">$i</span><span class="hl-code">=</span><span class="hl-number">2</span><span class="hl-code">; </span><span class="hl-var">$i</span><span class="hl-code"> &lt;= </span><span class="hl-var">$n</span><span class="hl-code">; </span><span class="hl-var">$i</span><span class="hl-code">+=</span><span class="hl-number">2</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
</span><span class="hl-var">$d</span><span class="hl-code"> = </span><span class="hl-identifier">intval</span><span class="hl-brackets">(</span><span class="hl-identifier">substr</span><span class="hl-brackets">(</span><span class="hl-var">$aData</span><span class="hl-code">,-</span><span class="hl-var">$i</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$ot</span><span class="hl-code"> += </span><span class="hl-var">$d</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> Calculate the checkdigit</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$tot</span><span class="hl-code"> = </span><span class="hl-number">3</span><span class="hl-code">*</span><span class="hl-var">$et</span><span class="hl-code"> + </span><span class="hl-var">$ot</span><span class="hl-code">;
</span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">10</span><span class="hl-code"> - </span><span class="hl-brackets">(</span><span class="hl-var">$tot</span><span class="hl-code"> % </span><span class="hl-number">10</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">%</span><span class="hl-number">10</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div><p>
</p>
</li><li class="listitem">
<p><span class="bold"><strong><code class="code">function
GetPIC($aServiceType,$aDUNS,$aSeqNbr)</code></strong></span></p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags">&lt;?php</span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> Get type 2 of confirmation code (without ZIP)</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">GetPIC</span><span class="hl-brackets">(</span><span class="hl-var">$aServiceType</span><span class="hl-code">,</span><span class="hl-var">$aDUNS</span><span class="hl-code">,</span><span class="hl-var">$aSeqNbr</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> Convert to USPS format with AI=91</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$data</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">91</span><span class="hl-quotes">'</span><span class="hl-code"> . </span><span class="hl-var">$aServiceType</span><span class="hl-code"> . </span><span class="hl-var">$aDUNS</span><span class="hl-code"> . </span><span class="hl-var">$aSeqNbr</span><span class="hl-code">;
</span><span class="hl-var">$cd</span><span class="hl-code"> = </span><span class="hl-var">$this</span><span class="hl-code">-&gt;</span><span class="hl-identifier">_USPS_chkd</span><span class="hl-brackets">(</span><span class="hl-var">$data</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-var">$data</span><span class="hl-code"> . </span><span class="hl-var">$cd</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div><p>
</p>
</li><li class="listitem">
<p><span class="bold"><strong><code class="code">function
GetPICwithZIP($aZIP,$aServiceType,$aDUNS,$aSeqNbr)</code></strong></span></p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags">&lt;?php</span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> Get type 1 of confirmation code (with ZIP)</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">GetPICwithZIP</span><span class="hl-brackets">(</span><span class="hl-var">$aZIP</span><span class="hl-code">,</span><span class="hl-var">$aServiceType</span><span class="hl-code">,</span><span class="hl-var">$aDUNS</span><span class="hl-code">,</span><span class="hl-var">$aSeqNbr</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> Convert to USPS format with AI=420 and extension starting </span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> with AI=91</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$data</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">420</span><span class="hl-quotes">'</span><span class="hl-code">. </span><span class="hl-var">$aZIP</span><span class="hl-code"> . </span><span class="hl-quotes">'</span><span class="hl-string">91</span><span class="hl-quotes">'</span><span class="hl-code"> . </span><span class="hl-var">$aServiceType</span><span class="hl-code"> .
</span><span class="hl-var">$aDUNS</span><span class="hl-code"> . </span><span class="hl-var">$aSeqNbr</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Only calculate the checkdigit from the AI=91 and forward</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> and do not include the ~1 (FUNC1) in the calculation</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$cd</span><span class="hl-code"> = </span><span class="hl-var">$this</span><span class="hl-code">-&gt;</span><span class="hl-identifier">_USPS_chkd</span><span class="hl-brackets">(</span><span class="hl-identifier">substr</span><span class="hl-brackets">(</span><span class="hl-var">$data</span><span class="hl-code">,</span><span class="hl-number">8</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$data</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">420</span><span class="hl-quotes">'</span><span class="hl-code">. </span><span class="hl-var">$aZIP</span><span class="hl-code"> . </span><span class="hl-quotes">'</span><span class="hl-string">~191</span><span class="hl-quotes">'</span><span class="hl-code"> . </span><span class="hl-var">$aServiceType</span><span class="hl-code"> .
</span><span class="hl-var">$aDUNS</span><span class="hl-code"> . </span><span class="hl-var">$aSeqNbr</span><span class="hl-code">;
</span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-var">$data</span><span class="hl-code"> . </span><span class="hl-var">$cd</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div><p>
</p>
<p>All that now remains is to tie this together with the EAN-128 standard
barcode generation in order to crate the confirmation code. The
following script shows how this can be done </p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags">&lt;?php</span><span class="hl-code">
</span><span class="hl-var">$zip</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">92663</span><span class="hl-quotes">'</span><span class="hl-code">; </span><span class="hl-comment">//</span><span class="hl-comment"> Zip code</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$service</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">21</span><span class="hl-quotes">'</span><span class="hl-code">; </span><span class="hl-comment">//</span><span class="hl-comment"> Service 21 = Priority Mail</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$DUNS</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">805213907</span><span class="hl-quotes">'</span><span class="hl-code">; </span><span class="hl-comment">//</span><span class="hl-comment"> DUNS</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$seqnr</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">04508735</span><span class="hl-quotes">'</span><span class="hl-code">; </span><span class="hl-comment">//</span><span class="hl-comment"> Seqnr</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$usps</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">USPS_Confirmation</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$data</span><span class="hl-code"> = </span><span class="hl-var">$usps</span><span class="hl-code">-&gt;</span><span class="hl-identifier">GetPICwithZIP</span><span class="hl-brackets">(</span><span class="hl-var">$zip</span><span class="hl-code">,</span><span class="hl-var">$service</span><span class="hl-code">,</span><span class="hl-var">$DUNS</span><span class="hl-code">,</span><span class="hl-var">$seqnr</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$encoder</span><span class="hl-code"> = </span><span class="hl-identifier">BarcodeFactory</span><span class="hl-code">::</span><span class="hl-identifier">Create</span><span class="hl-brackets">(</span><span class="hl-identifier">ENCODING_EAN128</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$e</span><span class="hl-code"> = </span><span class="hl-identifier">BackendFactory</span><span class="hl-code">::</span><span class="hl-identifier">Create</span><span class="hl-brackets">(</span><span class="hl-identifier">BACKEND_IMAGE</span><span class="hl-code">,</span><span class="hl-var">$encoder</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$e</span><span class="hl-code">-&gt;</span><span class="hl-identifier">SetModuleWidth</span><span class="hl-brackets">(</span><span class="hl-number">2</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$e</span><span class="hl-code">-&gt;</span><span class="hl-identifier">SetFont</span><span class="hl-brackets">(</span><span class="hl-identifier">FF_ARIAL</span><span class="hl-code">,</span><span class="hl-identifier">FS_NORMAL</span><span class="hl-code">,</span><span class="hl-number">14</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$e</span><span class="hl-code">-&gt;</span><span class="hl-identifier">Stroke</span><span class="hl-brackets">(</span><span class="hl-var">$data</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div><p>
</p>
<p>The script above will then generate the following barcode </p>
<div class="figure"><a name="id2620371"></a><p class="title"><b>Figure 33.2. USPS example 1</b></p><div class="figure-contents">
<div class="mediaobject"><img src="images/usps_ex1.png" alt="USPS example 1"></div>
</div></div><br class="figure-break">
</li></ol></div><p>
</p>
<p>
</p><div class="caution" title="Caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3>
<p>Even though only numbers are input to the PIC, integers should not be used
since initial "0":s will be lost. Use strings as the example above shows.
</p>
</div><p>
</p>
<p><span class="bold"><strong>Additional example</strong></span></p>
<p>The following script shows how to generate PIC that does not use Zip codes. </p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags">&lt;?php</span><span class="hl-code">
</span><span class="hl-var">$service</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">01</span><span class="hl-quotes">'</span><span class="hl-code">; </span><span class="hl-comment">//</span><span class="hl-comment"> Priority mail</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$DUNS</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">123456789</span><span class="hl-quotes">'</span><span class="hl-code">; </span><span class="hl-comment">//</span><span class="hl-comment"> DUNS</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$seqnr</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">00000001</span><span class="hl-quotes">'</span><span class="hl-code">; </span><span class="hl-comment">//</span><span class="hl-comment"> Seqnr</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$usps</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">USPS_Confirmation</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$data</span><span class="hl-code"> = </span><span class="hl-var">$usps</span><span class="hl-code">-&gt;</span><span class="hl-identifier">GetPIC</span><span class="hl-brackets">(</span><span class="hl-var">$service</span><span class="hl-code">,</span><span class="hl-var">$DUNS</span><span class="hl-code">,</span><span class="hl-var">$seqnr</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$encoder</span><span class="hl-code"> = </span><span class="hl-identifier">BarcodeFactory</span><span class="hl-code">::</span><span class="hl-identifier">Create</span><span class="hl-brackets">(</span><span class="hl-identifier">ENCODING_EAN128</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$e</span><span class="hl-code"> = </span><span class="hl-identifier">BackendFactory</span><span class="hl-code">::</span><span class="hl-identifier">Create</span><span class="hl-brackets">(</span><span class="hl-identifier">BACKEND_IMAGE</span><span class="hl-code">,</span><span class="hl-var">$encoder</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$e</span><span class="hl-code">-&gt;</span><span class="hl-identifier">SetModuleWidth</span><span class="hl-brackets">(</span><span class="hl-number">2</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$e</span><span class="hl-code">-&gt;</span><span class="hl-identifier">SetFont</span><span class="hl-brackets">(</span><span class="hl-identifier">FF_ARIAL</span><span class="hl-code">,</span><span class="hl-identifier">FS_NORMAL</span><span class="hl-code">,</span><span class="hl-number">14</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$e</span><span class="hl-code">-&gt;</span><span class="hl-identifier">Stroke</span><span class="hl-brackets">(</span><span class="hl-var">$data</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div><p>
</p>
<p>The script above will generate the following confirmation barcode.</p>
<div class="figure"><a name="id2620430"></a><p class="title"><b>Figure 33.3. USPS example 2</b></p><div class="figure-contents">
<div class="mediaobject"><img src="images/usps_ex2.png" alt="USPS example 2"></div>
</div></div><br class="figure-break">
<p>A complete script to implement this is available in the distribution as
"<code class="filename">barcode/examples/barcode_usps_example.php</code>"</p>
</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="pt08.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>