php FPDF类库应用实现代码

2019-04-10 12:21:12王旭

$this->Cell(30,10,'Title'); //写入页眉文字
$this->Ln(20); //换行
}

function Footer() //设置页脚
{
$this->SetY(-15); //设置页脚所在位置
$this->SetFont('Arial','I',8); //设置页脚字体
$this->Cell(0,10,'Page - '.$this->PageNo()); //输出当前页码作为页脚内容
}
}

$pdf=new PDF('P', 'mm', 'A4'); //创建新的FPDF对象,竖向放纸,单位为毫米,纸张大小A4
$pdf->Open(); //开始创建PDF
$pdf->AddPage(); //增加一页
$pdf->SetFont('Courier','I',20); //设置字体样式
$pdf->Cell(0,0,'Hello World!'); //增加一个单元格
$pdf->Output(); //输出PDF到浏览器
?>
相关文章 大家在看