当用FPDF类生PDF文件时,在用于可输出中文的PDF_Unicode扩展类时,页眉和页脚用中文字体时,报严重错误.
代码如下:
class P extends PDF_Unicode{
function header(){
$this->AddUniCNShwFont('ugb');
$this->SetFont('ugb','','20');
$this->Cell(30,20,'中文',0,1);
$this->Ln();
$this->SetFont('ugb','','20');
$this->Cell(30,20,'中文',0,1);
$this->Ln();
$this->SetFont('ugb','','13');
$this->Cell(30,20,'中文',0,1);
}
}
$p = new P();
//$p->Open();
//$p->AddPage();
$p->header();
$p->Output();
页面报错为:FPDF error: Font already added: ugb
当把上面的$this->AddUniCNShwFont('ugb');这行代码注销时
页面报错为:FPDF error: Undefined font: ugb
求用过这个类的给解答一下,O(∩_∩)O谢谢