Exemplo n.º 1
0
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $array = str_split($this->text, 1);
     $textlength = array_sum($array) + count($array);
     $w += $textlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $startlength = 4;
     $textlength = 5 * 7;
     $intercharlength = 2 * 4;
     $w += $startlength + $textlength + $intercharlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $startlength = 3;
     $centerlength = 5;
     $textlength = 12 * 7;
     $endlength = 3;
     $w += $startlength + $centerlength + $textlength + $endlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
Exemplo n.º 4
0
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $textlength = 12 * strlen($this->text);
     $startlength = 3;
     $checksumlength = $this->checksum * 12;
     $endlength = 4;
     $w += $startlength + $textlength + $checksumlength + $endlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $textlength = 13 * strlen($this->text);
     $startlength = 13;
     $checksumlength = 0;
     if ($this->checksum === true) {
         $checksumlength = 13;
     }
     $endlength = 13;
     $w += $startlength + $textlength + $checksumlength + $endlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
Exemplo n.º 6
0
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $c = strlen($this->text);
     $startlength = 6;
     $textlength = $c * 5 * 6;
     $checksumlength = 5 * 6;
     $endlength = 6;
     // We remove the white on the right
     $removelength = -3;
     $w += $startlength + $textlength + $checksumlength + $endlength + $removelength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
Exemplo n.º 7
0
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $c = strlen($this->text);
     $startlength = 8;
     $textlength = $c * 14;
     $checksumlength = 0;
     if ($c % 2 !== 0) {
         $checksumlength = 14;
     }
     $endlength = 7;
     $w += $startlength + $textlength + $checksumlength + $endlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $textLength = 0;
     $c = strlen($this->text);
     for ($i = 0; $i < $c; $i++) {
         $index = $this->findIndex($this->text[$i]);
         if ($index !== false) {
             $textLength += 8;
             $textLength += substr_count($this->code[$index], '1');
         }
     }
     $w += $textLength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
Exemplo n.º 9
0
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $startlength = 8;
     $textlength = 0;
     $c = strlen($this->text);
     for ($i = 0; $i < $c; $i++) {
         $textlength += $this->getIndexLength($this->findIndex($this->text[$i]));
     }
     $checksumlength = 0;
     $this->calculateChecksum();
     $c = count($this->checksumValue);
     for ($i = 0; $i < $c; $i++) {
         $checksumlength += $this->getIndexLength($this->checksumValue[$i]);
     }
     $endlength = 7;
     $w += $startlength + $textlength + $checksumlength + $endlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $textlength = 0;
     $c = strlen($this->text);
     for ($i = 0; $i < $c; $i++) {
         $index = $this->findIndex($this->text[$i]);
         if ($index !== false) {
             $textlength += 6;
             $textlength += substr_count($this->code[$index], '1');
         }
     }
     $startlength = 8;
     // We take the max length possible for checksums (it is 7 or 8...)
     $checksumlength = 8;
     if ($c >= 10) {
         $checksumlength += 8;
     }
     $endlength = 7 * $this->scale;
     $w += $startlength + $textlength + $checksumlength + $endlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
Exemplo n.º 11
0
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $w += 65 * 3;
     $h += $this->thickness;
     // We remove the white on the right
     $w -= 1.56;
     if ($this->quietZone) {
         $w += 18;
         $h += 4;
     }
     return parent::getDimension($w, $h);
 }
Exemplo n.º 12
0
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     // Contains start + text + checksum + stop
     $textlength = count($this->data) * 11;
     $endlength = 2;
     // + final bar
     $w += $textlength + $endlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
Exemplo n.º 13
0
 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $textlength = 13 * count($this->data);
     $startlength = 13;
     $checksumlength = 0;
     if ($this->checksum === true) {
         $checksumlength = 13;
     }
     $endlength = 13;
     $w += $startlength + $textlength + $checksumlength + $endlength;
     $h += $this->thickness;
     return BCGBarcode1D::getDimension($w, $h);
 }
     * @param resource $im

     */
    public function draw($im)
    {
        // Starting *
        $this->drawChar($im, $this->code[$this->starting], true);
        $c = count($this->data);
        for ($i = 0; $i < $c; $i++) {
            $this->drawChar($im, $this->data[$i], true);
        }
        // Checksum
        $c = count($this->checksumValue);
        for ($i = 0; $i < $c; $i++) {
            $this->drawChar($im, $this->code[$this->checksumValue[$i]], true);
        }
        // Ending *
        $this->drawChar($im, $this->code[$this->ending], true);