fpdf:标头在fpdf中不起作用

时间:2016-04-17 21:04:22

标签: php fpdf

我已经使用了fpdf库并根据fpdf的官方文档使用它。

我想在我的文件中使用标题但不能使用它,下面是我的代码。请更正我的错误,为什么标题不会来......

这是我的代码:

<?php

require('fpdf/fpdf.php');

class PDF extends FPDF
{
function Header()
{
    // Select Arial bold 15
    $this->SetFont('Arial','B',5);
    // Move to the right
    $this->Cell(80,'ddd');
    // Framed title
    $this->Cell(30,10,'Title',1,0,'C');
    $this->Cell(20,10,'Title',1,1,'C');
    // Line break
    $this->Ln(20);
}
}

$pdf=new FPDF();

$pdf->AddPage();
$pdf->SetFont('Times','B',14);

$pdf->Cell(20,10,'Title',1,1,'C');
$pdf->Output();
?>

1 个答案:

答案 0 :(得分:4)

根据PetrHejda的评论,您需要做的就是改变

$ pdf = new FPDF();

$ pdf = new PDF();

相关问题