我有这个示例代码:
<?php
session_start();
define('FPDF_FONTPATH', 'font/');
require('fpdf/rotation.php');
class PDF extends PDF_Rotate
{
function Header()
{
//Put the watermark
$this->SetFont('Arial','B',50);
$this->SetTextColor(255,192,203);
$this->RotatedText(35,190,'Preview Only!',45);
}
function RotatedText($x, $y, $txt, $angle)
{
//Text rotated around its origin
$this->Rotate($angle,$x,$y);
$this->Text($x,$y,$txt);
$this->Rotate(0);
}
}
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',12);
$pdf->Cell(40,10,'Sample line');
$pdf->Output();
?>
它显示PDF文件,但不显示水印。我究竟做错了什么?请帮我。感谢。
答案 0 :(得分:1)
我只需要将$pdf = new FPDF();
更改为$pdf = new PDF();