php - How to manually position a barcode in tcpdf -
i'm trying add barcodes programmatically in pdf file think i'm not understanding correctly regarding positioning.here's code
$pdf = new tcpdf("l", "mm", array(80, 40), true, 'utf-8', false); $pdf->setmargins(3, 3, 3); // remove default header/footer $pdf->setprintheader(false); $pdf->setprintfooter(false); $pdf->setfontsubsetting(true); $pdf->setfont('freeserif', '', 12); foreach ($barcodes $barcode){ $pdf->addpage(); $x = $pdf->getx(); $y = $pdf->gety(); $style = array( 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0,0,0), 'bgcolor' => false, //array(255,255,255), 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4 ); //$pdf->cell(30, 1, 'ean 13', 0, 1); $pdf->write1dbarcode($barcode, 'ean13', '5', '6', '60', 14, 0.4, $style, 'n'); }
the result image or in way not close outputting barcode i'd , have no clue why. i'd appreciate help
if use $pdf->write1dbarcode($barcode, 'ean13', '5', '5', '60', 14, 0.4, $style, 'n');
there no empty pdf page barcode still high. i'd go 1/3 top around 14mm that's why trying fiddle y
variable in write1dbarcode
after lots of fiddling around found it.
adding
$pdf->setautopagebreak(true, 0);
made autobreak behave correctly
my guess bottom margin set default messing around alignment vertically can't set using $pdf->setmargins. in case problem solved me. trying help
Comments
Post a Comment