在pdf中使用阿拉伯语单词

问题描述

我正在尝试用阿拉伯语生成 pdf,但单词在 pdf 中没有正确呈现,我正在使用基于 fpdf 构建的 PHP 脚本 以pdf格式生成无法正常工作的发票,它使用英文单词正常工作 我尝试过的: - 下载支持阿拉伯字母的字体 下面是我的代码

require('MysqL_table.PHP');
// $name="";
$pid=$_GET['invoice'];
  $np=$_SESSION['net_amountt'];

class PDF extends PDF_MysqL_Table
{
function Header()
{ $name=$_SESSION['admin'];
$d=date("Y-m-d H:i:s");
    //Title
    $this->AddFont('Cairo-Regular','B','Cairo-Regular.PHP');
    $this->SetFont('Cairo-Regular','',18);
    $this->Cell(0,6,'الفاتورة',1,'C');
        $this->Cell(0,"$d",'R');
        $this->Cell(0,"الاسم:$name",'L');
    $this->Ln(10);
    //Ensure table header is output
    parent::Header();
}
}



//Connect to database
// MysqL_connect('localhost','root','35437411');
// MysqL_select_db('egrocery');




$pdf=new PDF();
$pdf->AddFont('Cairo-Regular','Cairo-Regular.PHP');

$pdf->AddPage();
//First table: put all columns automatically
//$pdf->Table('select * from order_detail where customer_id="'.$pid.'"');
//$pdf->AddPage();
//Second table: specify 3 columns
//$pdf->AddCol('id',20,'C');
$pdf->AddCol('المنتج',40,'product');
$pdf->AddCol('السعر','price','R');
$pdf->AddCol('الكمية','Quantity','R');
$prop=array('HeaderColor'=>array(100,150,100),'color1'=>array(210,245,255),'color2'=>array(255,255,210),'padding'=>2);
//calling stored procedure for fetchng order detail of user
$stp='call order_details("fetch","",'.$pid.',"")';

$pdf->Table($stp,$prop);


$con= new PDO("MysqL:host=localhost;dbname=egrocery","root","35437411");
$con->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
//calling stored procedure for fetchng total amount of user
$stp1="call payment(?,?,?)";
$evnt="fetch_total";
$a="";

//$st=$con->prepare('SELECT SUM(payment.total_payment)as Total_Amount FROM payment WHERE payment.customer_id='.$pid.'');
$st=$con->prepare($stp1);
$st->bindParam(1,$evnt);
$st->bindParam(2,$pid);
$st->bindParam(3,$a);
$st->bindParam(4,$a);
$st->bindParam(5,$a);
$st->bindParam(6,$a);
$st->bindParam(7,$a);
$st->setFetchMode(PDO::FETCH_OBJ);
$st->execute();
    
$pdf->Ln(11);
$fontPath = constant("FPDF_FONTPATH");

$pdf->SetFont('Cairo-Regular',16);
$pdf->Cell(0,"القيمة الاجمالية".$st->fetchColumn()."",'C');
$pdf->Output();

这是pdf输出的屏幕截图:

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)