I am using the following code to generate 1D Barcode.
//set standard size for label 174mmx100mm, dont pass orientation as that seems to break things
$pdf = new tcpdf('', PDF_UNIT, array(174,100), true, 'UTF-8', false);
$pdf->IncludeJS("print(true);");
$pdf->SetFontSize(10);
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//set image scale factor
$pdf->setImageScale(1.53);
//turn off auto page breaks which aren't useful here
$pdf->SetAutoPageBreak(false);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// set JPEG quality
$pdf->setJPEGQuality(100);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetDisplayMode('real', 'SinglePage');
$style = array(
'position' => '',
'align' => 'C',
'stretch' => false,
'fitwidth' => true,
'cellfitalign' => '',
'border' => false,
'padding' => 0,
'hpadding' => 'auto',
'vpadding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false, //array(255,255,255),
'font' => 'helvetica',
'fontsize' => 8,
'stretchtext' => 4
);
$pdf->Text(self::pxtomm(124), self::pxtomm(206), $la_barcodedata['barcode']);
//tall 1d barcode
$pdf->write1DBarcode('2245950000007601AKL001AS', 'C128B', self::pxtomm(72), self::pxtomm(226), self::pxtomm(279), self::pxtomm(57), 0.4, $style, 'N');
// The conversion method just for reference
private function pxtomm($pi_pixels)
{
return $pi_pixels * 0.264583333;
}
Now the issue is the generate pdf document looks different in IE, FF, Chrome. All barcodes printed from IE cannot be scanned because the barcode lines overlaps and make it look like a single block. If I zoom in and out I can see the distinct lines but not on the actual page fit size.
What is the best way to avoid that and make it look consistant across all browsers ?