2

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

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,但我无法获得正确的宽度或高度。

在此处输入图像描述

下面是我的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');
4

0 回答 0