2013-04-12 32 views
2

我有这样的示例代码:FPDF水印不会出现

<?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文件,但它并不显示的水印。我究竟做错了什么?请帮帮我。谢谢。

回答

1

我只需将$pdf = new FPDF();更改为$pdf = new PDF();