Source for file BarcodeObject
Documentation is available at BarcodeObject 
//============================================================+  
// File name   : c39object.php  
// Last Update : 2004-12-29  
// Author      : Karim Mribti [barcode@mribti.com]  
//             : Nicola Asuni [info@tecnick.com]  
// Version     : 0.0.8a  2001-04-01 (original code)  
// License     : GNU LGPL (Lesser General Public License) 2.1  
//               http://www.gnu.org/copyleft/lesser.txt  
// Source Code : http://www.mribti.com/barcode/  
// Description : Code 39 Barcode Render Class for PHP using  
//               the GD graphics library.  
//               Code 39 is an alphanumeric bar code that can  
//               encode decimal number, case alphabet and some  
// This version contains changes by Nicola Asuni:  
//  - code style and formatting  
//  - automatic php documentation in PhpDocumentor Style  
//============================================================+  
 * Code 39 Barcode Render Class.<br>  
 * Code 39 is an alphanumeric bar code that can encode decimal number, case alphabet and some special symbols.  
 * @author Karim Mribti, Nicola Asuni  
 * @package linea21.externals  
 * @subpackage com.tecnick.tcpdf  
 * @version 0.0.8a  2001-04-01 (original code)  
 * @license http://www.gnu.org/copyleft/lesser.html LGPL  
 * Code 39 Barcode Render Class.<br>  
 * Code 39 is an alphanumeric bar code that can encode decimal number, case alphabet and some special symbols.  
 * @author Karim Mribti, Nicola Asuni  
 * @package linea21.externals  
 * @subpackage com.tecnick.tcpdf  
 * @version 0.0.8a  2001-04-01 (original code)  
 * @license http://www.gnu.org/copyleft/lesser.html LGPL  
     * @param int $Width Image width in pixels.  
     * @param int $Height Image height in pixels.  
     * @param int $Style Barcode style.  
     * @param int $Value value to print on barcode.  
    public function __construct($Width, $Height, $Style, $Value) {  
        $this->mChars =  "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";  
     * Returns the character index.  
     * @param char $char character.  
     * @return int character index or -1 in case of error.  
    private function GetCharIndex($char) {  
            if ($this->mChars[$i] ==  $char) {  
     * @param int $xres Horizontal resolution.  
    private function GetSize($xres) {  
        for ($i= 0;$i< $len;$i++ ) {  
            if ($this->GetCharIndex($this->mValue[$i]) == - 1 ||  $this->mValue[$i] ==  '*') {  
                /* The asterisk is only used as a start and stop code */  
                $this->mError =  "C39 not include the char '". $this->mValue[$i]. "'";  
        /* Start, Stop is 010010100 == '*'  */  
        return $CharSize *  $len +  $StartSize +  $StopSize +  /* Space between chars */ BCD_C39_NARROW_BAR *  $xres *  ($len- 1);  
     * @param int $DrawPos Drawing position.  
     * @param int $yPos Vertical position.  
     * @param int $ySize Vertical size.  
     * @param int $xres Horizontal resolution.  
     * @return int drawing position.  
    private function DrawStart($DrawPos, $yPos, $ySize, $xres) {  
        $DrawPos +=  $narrow; /* Space between chars */  
     * @param int $DrawPos Drawing position.  
     * @param int $yPos Vertical position.  
     * @param int $ySize Vertical size.  
     * @param int $xres Horizontal resolution.  
     * @return int drawing position.  
    private function DrawStop($DrawPos, $yPos, $ySize, $xres) {  
     * Draws the barcode object.  
     * @param int $xres Horizontal resolution.  
     * @return bool true in case of success.  
        if (($size =  $this->GetSize($xres))== 0) {  
        /* Total height of bar code -Bars only- */  
                for ($i= 0;$i< $len;$i++ ) {  
                    $this->DrawChar($this->mFont, $sPos+ ($narrow* 6+ $wide* 3)+ ($size/ $len)* $i,  
            $this->DrawText($this->mFont, $sPos+ (($size- $text_width)/ 2)+ ($narrow* 6+ $wide* 3),  
            $c     =  $this->GetCharIndex($this->mValue[$cPos]);  
            $DrawPos +=  ($cset[0] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  ($cset[1] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  ($cset[2] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  ($cset[3] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  ($cset[4] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  ($cset[5] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  ($cset[6] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  ($cset[7] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  ($cset[8] ==  '0') ?  $narrow :  $wide;  
            $DrawPos +=  $narrow; /* Space between chars */  
//============================================================+  
//============================================================+  
 
 
        
       |