使用codeigniter / core php生成2X6贴纸的TCPDF贴纸

时间:2014-10-08 09:44:23

标签: tcpdf

需要使用A4尺寸格式的TCPDF和codeigniter / core php创建12个贴纸(2X6)。

以下是pastebin中的代码段 http://pastebin.com/kbevqtfX

期望的结果应该是这样的 http://imgur.com/NMpUYNw

2 个答案:

答案 0 :(得分:1)

  

    $top_margin = 32;
    $side_margin = 16;
    $vertical_pitch = 85;
    $horizantal_pitch = 350;
    $label_height = 44;
    $label_width = 100;
    $width = 212;
    $height = 315;
    $resolution = array($height, $width);

    echo "<table>";
    for($i=1;$i<=6;$i++){
    $txt = '<tr style="width:100%"><td style="margin-top:'.$top_margin.'px;margin-left:'.$side_margin.'px;width:'.$horizantal_pitch.'px;height:'.$vertical_pitch.'px;float:left">Card Ref No: 10166<br>Abhilasha S Mishra<br>Golden Encalve, KVMR, Block C, Near Manipal, Bangalore, 560034, Karnataka, TEL: 234567897</td>
    <td style="margin-top:'.$top_margin.'px;margin-left:'.$side_margin.'px;width:'.$horizantal_pitch.'px;height:'.$vertical_pitch.'px;float:left">Card Ref No: 10166<br>Abhilasha S Mishra<br>Golden Encalve, KVMR, Block C, Near Manipal, Bangalore, 560034, Karnataka, TEL: 234567897</td></tr>'; 

    echo $txt;
    }
    echo "</table>";

&GT?; 使用此

答案 1 :(得分:1)

我找到了制作这些贴纸的更好方法。我已经从html部分替换了div并使用了表而不是它。代码片段在pastebin中 http://pastebin.com/0sryTihK