【问题标题】:TCPDF write custom barcode in html templateTCPDF 在 html 模板中编写自定义条码
【发布时间】:2011-07-21 13:22:25
【问题描述】:

而不是在 action.class.php 中键入以下内容: $pdf->write1DBarcode('CODE 39', 'C39', '', '', '', 18, 0.4, '', 'N');

我怎样才能让它自定义,以便我可以在模板中编写它?

原因是当我必须在一页中两次标记相同的条形码时...正常的条形码只能在一页中执行一次...请帮助我...我很感激它.. :D

【问题讨论】:

    标签: php symfony1 barcode symfony-1.4 tcpdf


    【解决方案1】:

    您可以在 HTML 中编写 TCPDF 方法,如下所示

    <?php
    $params = $pdf->serializeTCPDFtagParameters(array('40144399300102444888207482244309', 'C128C', '', '', 0, 0, 0.2, array('position'=>'S', 'border'=>false, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>false, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>2), 'N'));    
    $str='<table cellspacing="0" cellpadding="1" border="0">            
    <tr> 
        <td align="left">barcode</td>
    </tr>
    <tr> 
        <td align="center" style="padding-left:5px;">';
        $str .= '<tcpdf method="write1DBarcode" params="'.$params.'" />';
        $str .='</td>
    </tr>
    </table>';
    
    $pdf->writeHTML($str,true, false,false,false,'left');
    $pdf->Output('example_049.pdf', 'I');
    ?>
    

    详细参考请查看TCPDF example_049.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-16
      • 2012-09-04
      • 1970-01-01
      • 2011-02-17
      • 1970-01-01
      • 2012-03-05
      • 1970-01-01
      • 2017-10-20
      相关资源
      最近更新 更多