How to manually position a barcode in tcpdf
<p>I'm trying to add some barcodes programmatically in a pdf file but I think I'm not understanding something correctly regarding positioning.Here's my code</p>

<pre class="lang-php prettyprint-override"><code>    $pdf = new TCPDF("L", "mm", array(80, 40), true, 'UTF-8', false);
    $pdf-&gt;SetMargins(3, 3, 3);

    // remove default header/footer
    $pdf-&gt;setPrintHeader(false);
    $pdf-&gt;setPrintFooter(false);

    $pdf-&gt;setFontSubsetting(true);
    $pdf-&gt;SetFont('freeserif', '', 12);

    foreach ($barcodes as $barcode){

        $pdf-&gt;AddPage();

        $x = $pdf-&gt;GetX();
        $y = $pdf-&gt;GetY();

        $style = array(
            'border' =&gt; true,
            'hpadding' =&gt; 'auto',
            'vpadding' =&gt; 'auto',
            'fgcolor' =&gt; array(0,0,0),
            'bgcolor' =&gt; false, //array(255,255,255),
            'text' =&gt; true,
            'font' =&gt; 'helvetica',
            'fontsize' =&gt; 8,
            'stretchtext' =&gt; 4
        );
        //$pdf-&gt;Cell(30, 1, 'EAN 13', 0, 1);
        $pdf-&gt;write1DBarcode($barcode, 'EAN13', '5', '6', '60', 14, 0.4, $style, 'N');

 }
</code></pre>

<p>The result I get is like the image or in any way not even close to outputting the barcode where I'd like it to be and I have no clue why. I'd appreciate any help</p>

<p><a href="https://i.stack.imgur.com/bmjdH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bmjdH.jpg" alt="at 6"></a></p>

<p>if i use
    <code>$pdf-&gt;write1DBarcode($barcode, 'EAN13', '5', '5', '60', 14, 0.4, $style, 'N');</code></p>

<p><a href="https://i.stack.imgur.com/9n5YG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9n5YG.jpg" alt="at 5"></a></p>

<p>There is no empty pdf page but the barcode is still really high. I'd like it to go like 1/3 from top around 14mm that's why I was trying to fiddle with the <code>y</code> variable in <code>write1DBarcode</code></p>