Fpdf无法正常工作并返回错误

时间:2013-10-04 04:24:42

标签: php

我从互联网上下载了一些代码,用PHP生成pdf但是我返回错误请帮忙。

<?php
 require('fpdf.php');

 class PDF extends FPDF
 {
function Header(){
    $this->Image('logo.jpg',10,6,30);
    $this->SetFont('Arial','B',15);
     $this->Cell(80);
     $this->Cell(30,10,'Title',1,0,'C');
    $this->Ln(20);
}

function ChapterBody(){
    $txt = file_get_contents($file);
    $this->SetFont('Times','',12);
    $this->MultiCell(0,5,$txt);
    $this->Ln();
    $this->SetFont('','I');
    $this->Cell(0,5,'(end of excerpt)');
}

function Footer(){
    $this->SetY(-15);
    $this->SetFont('Arial','I',8);
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
 }
 $pdf = new PDF();
 $pdf->AliasNbPages();
 $pdf->AddPage();
 $pdf->SetFont('Times','I',8);

 for($i=1; $i<=40; $i++)
  $pdf->Cell(0,10,'Printing line number'.$i,0,1);
 $pdf->Output();
?>

错误:某些数据已经输出,无法发送PDF文件

0 个答案:

没有答案
相关问题