douzong5057 2014-12-07 00:27
浏览 379

TCPDF条形码问题

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 ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
    • ¥15 求daily translation(DT)偏差订正方法的代码
    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机