我该如何使用<pre> html tag in tcpdf library?

时间:2017-05-03 14:28:21

标签: php mysql tcpdf

<?php
require 'tcpdf/tcpdf.php';
include 'clasess/DBConnect.php'; 
$db= DataBase::getInstance();
$query = mysql_qstrong textuery("SELECT * from post  order by post_id DESC"); 
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->AddPage();
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING);
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetTextColor(100,7,20);
$pdf->SetFont('aealarabiya', '', 18);
$lg = Array();
$lg['a_meta_charset'] = 'UTF-8';
$lg['a_meta_dir'] = 'rtl';
$lg['a_meta_language'] = 'fa';
$lg['w_page'] = 'page';
$pdf->setLanguageArray($lg);
$pdf->setRTL(false);
while($rows = mysql_fetch_array($query)){
    $data = "<pre>". $rows['content'] ."</pre>";

    $pdf->writeHTML($data ,true,0,true,0);
    $pdf->Ln();
}

$pdf->Output();

when i use pre tag .. my Arabic words show like this ???? How can I solve Arabic language problem when using pre tage the problem shows in the image

enter image description here

0 个答案:

没有答案