【发布时间】:2020-01-21 12:47:54
【问题描述】:
require('fpdf/fpdf.php');
class PDF extends FPDF
{
function Header()
{
// Logo
$this->Image('asset/logo.png',10,6,20);
// Arial bold 15
$this->SetFont('Arial','B',15);
// Move to the right
$this->Cell(80);
// Title
$this->SetDrawColor(0,80,180);
$this->SetFillColor(230,230,0);
$this->SetTextColor(220,50,50);
$this->Cell(100,15,'FREE PEACE ASSESSMENT',1,0,'C');
// Line break
$this->Ln(20);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
// Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$html='<p>HI</p>';
$pdf->WriteHTML(utf8_decode($html));
$pdf->Output();
这是我的代码。我只是使用 $html 来使用 writehtml 但我遇到了一个错误 致命错误:未捕获的错误:调用未定义的方法 PDF::WriteHTML() 错误:调用未定义的方法 PDF::WriteHTML() ....
【问题讨论】:
-
使用这个 $pdf->WriteHTML('
HI
'); -
我使用了这种类型的代码,但没有响应,只是在下面添加它可以工作的内容