如何在tcpdf库中设置html元素的自定义位置

时间:2019-10-14 12:27:48

标签: php html css codeigniter tcpdf

在我的CodeIgniter项目中,我正在使用tcpdf库生成证书,但无法在html元素上使用position属性。  我想给出html元素的关系位置,

  $html = <<<EOF
<!-- EXAMPLE OF CSS STYLE -->
<style type="text/css">
 #first {
        font-family: helvetica;
        font-size: 5pt;
        text-align:left;
    }
#second {
        color: #003300;
        font-family: helvetica;
        font-size: 5pt;
        text-align:right;
    }


</style>

<div>
<span id='first' >$cer_no</span> 
<span id='second' >$date </span> 
</div>
<br/>
<br/>

<p style="color:black;text-align:center;font-weight:bold;font-size:20px; margin:10px;" > $name </p>
<p style="color:black;text-align:center;font-weight:bold;font-size:20px; margin:10px;" > $fname </p>
<p style="color:black;text-align:center;font-weight:bold;font-size:20px; margin:10px;" > $Course </p>

<br><br><br>
<p style="color:black;text-align:left;font-weight:bold;font-size:20px; margin:10px;" > $duration </p>
<p id="sixth" > $from </p>
<p id="seventh" > $Till </p>
<p id="eighth" > $type </p>
EOF;

// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');



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

0 个答案:

没有答案