tcpdf生成pdf417二维条码无法设置宽度

时间:2016-03-26 02:39:09

标签: php 2d barcode tcpdf pdf417

我尝试生成具有以下要求的条形码:

Barcode Type: PDF 417                                                    
Error Correction Length: 5                                                                 
Module Height/Length: 2                                                           
Scanning Method: Document Scanner
Data Compaction: Byte Compaction (BC)

Barcode Measurements Points Inches
Module Width: 0.958pt            0.0133in
Actual Width of Barcode: 540pt               7.5in
Actual Height of Barcode: 108pt               1.5in

我使用的是TCPDF,但我的宽度或高度不正确。

enter image description here

下面是我的PHP代码,有人可以帮我把宽度和高度设为正确吗

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', true, 'UTF-8', false);

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

// add a page
$pdf->AddPage();

$txt = 'I-90|06/30/15|1|||||||||||||||||This is a message|';

// set style for barcode
$style = array(
    'border' => 0,
    'vpadding' => 'auto',
    'hpadding' => 'auto',
    'fgcolor' => array(0,0,0),
    'bgcolor' => false, //array(255,255,255)
    'module_width' => 1, // width of a single module in points
    'module_height' => 1 // height of a single module in points
);

//write barcode
$pdf->write2DBarcode($txt, 'PDF417', 0, 10, 540, 108, $style, 'N');

//Close and output PDF document
$pdf->Output('example_002.pdf', 'I');

0 个答案:

没有答案