src/MyPdf.php
public function myBarcode($code, $type, $x, $y, $w, $h, $labelFontsize, $color, $dimension = '1D')
    {
        // the style of the barcode
        $style = array(
            'position' => 'S',
            'text' => ($labelFontsize ? true : false),
            'fgcolor' => $color,
            'bgcolor' => false,
        );

        // build the barcode
        if ($dimension === '2D') {
            // PDF417, DATAMATRIX ...
            $this->write2DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N');
        } else {
            $this->write1DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N');
        }

        // it Label => add the FontSize to the height
        if ($labelFontsize) {
            $h+= $labelFontsize;
        }

        // return the size of the barcode
        return array($w, $h);
    }
public function myBarcode($code, $type, $x, $y, $w, $h, $labelFontsize, $color, $dimension = '1D')
    {
        // the style of the barcode
        $style = array(
            'position' => 'S',
            'text' => ($labelFontsize ? true : false),
            'fgcolor' => $color,
            'bgcolor' => false,
        );

        // build the barcode
        if ($dimension === '2D') {
            // PDF417, DATAMATRIX ...
            $this->write2DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N');
        } else {
            $this->write1DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N');
        }

        // it Label => add the FontSize to the height
        if ($labelFontsize) {
            $h+= $labelFontsize;
        }

        // return the size of the barcode
        return array($w, $h);
    }
public function myBarcode ( $ code , $ type , $ x , $ y , $ w , $ h , $ labelFontsize , $ color , $ dimension = '1D' ) { // the style of the barcode $ style = array ( 'position' => 'S' , 'text' => ( $ labelFontsize ? true : false ) , 'fgcolor' => $ color , 'bgcolor' => false , ) ; // build the barcode if ( $ dimension === '2D' ) { // PDF417, DATAMATRIX ... $ this -> write2DBarcode ( $ code , $ type , $ x , $ y , $ w , $ h , '' , $ style , 'N' ) ; } else { $ this -> write1DBarcode ( $ code , $ type , $ x , $ y , $ w , $ h , '' , $ style , 'N' ) ; } // it Label => add the FontSize to the height if ( $ labelFontsize ) { $ h += $ labelFontsize ; } // return the size of the barcode return array ( $ w , $ h ) ; }
Convert a Html2Pdf barcode in a TCPDF barcode

@param string $code code to print
@param string $type type of barcode (see tcpdf/barcodes.php for supported formats)
@param int $x x position in user units
@param int $y y position in user units
@param int $w width in user units
@param int $h height in user units
@param int $labelFontsize of the Test Label. If false : no Label
@param array $color color of the foreground
@param string $dimension 1D or 2D
@access public
Convert a Html2Pdf barcode in a TCPDF barcode