【问题标题】:How to display the html entity in mpdf using codeigniter?如何使用codeigniter在mpdf中显示html实体?
【发布时间】:2016-09-26 04:29:58
【问题描述】:

我正在为 html 实体使用以下循环

for($i=0;$i<$service_count;$i++)
    {
        $services[$i]['serviceName']=$service_result[$i]['service_name'];
        $services[$i]['serviceId']=$service_result[$i]['services_id'];
        $services[$i]['serviceDesc']=$service_result[$i]['service_description'];
        $services[$i]['serviceAmt']=$serviceAmt[$i];
        $services[$i]['taxAmt']=$taxAmtarr[$i];
        $services[$i]['taxId']=$taxIdarr[$i];
        $tableRow='<tr>
                    <td style="text-align:center">'.$services[$i]['serviceName'].'</td>
                    <td style="text-align:center">'.$services[$i]['serviceDesc'].'</td>
                    <td style="text-align:right">'.$services[$i]['taxAmt'].'</td>
                    </tr>';

    }
 $test=htmlspecialchars($tableRow);

我的 mpdf 代码是

$invoice_original.='<table border="1" style="width:950px; border-collapse:collapse" cellpadding="15">
<tr style="background-color:#bfbfbf; ">
    <th style="text-align:center;color:#000066;">Particulars</th>
    <th style="text-align:center; color:#000066;">Description</th>
    <th style="text-align:center; color:#000066;">Amount(Rs)</th>
</tr>
'.$test.'

' $pdf->WriteHTML($invoice_original);

我想在 mpdf 表格中显示表格行。但是什么都没有显示。 谢谢。

【问题讨论】:

    标签: php codeigniter mpdf


    【解决方案1】:

    给你:

    $mpdf = new \mPDF('utf-8','A4');
    
    $mpdf->autoScriptToLang = true;
    $mpdf->baseScript = 1;  // Use values in classes/ucdn.php  1 = LATIN
    $mpdf->autoVietnamese = true;
    $mpdf->autoArabic = true;
    $mpdf->autoLangToFont = true;
    
    $mpdf->SetMargins(null,null,15);
    $mpdf->SetDisplayMode('fullpage');
    $mpdf->SetHTMLHeader('<div style="text-align:right">B I R A</div>');
    $mpdf->setFooter(' | www.bira.com | {PAGENO}');
    
    $mpdf->WriteHTML($pdf_style.$pdf_page);
    
    $mpdf->Output();
    

    身体应该是:

    $pdf_style = '<style>write all of your styles</style>';
    $pdf_page = '<table><table>'; // write all of your html markup here.
    

    就是这样!!!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-22
      • 2012-02-10
      • 2020-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多