【发布时间】:2014-08-29 23:13:50
【问题描述】:
我正在尝试测试 FPDF 的实现。下面是我正在测试的代码,但它一直给我错误:“致命错误:在第 5 行的 /home4/fwall/public_html/create-press-release.php 中找不到类 'FPDF'”。那是我调用下面代码的页面的 URL。
我已经验证了 FPDF 的 php 文件是从正确的位置需要的,而且它仍在发生。有谁能弄清楚发生了什么?
require(__DIR__.'/fpdf.php'); //The fpdf folder is in my root directory.
//create a FPDF object
$pdf=new FPDF();
//set document properties
$pdf->SetAuthor('Lana Kovacevic');
$pdf->SetTitle('FPDF tutorial');
//set font for the entire document
$pdf->SetFont('Helvetica','B',20);
$pdf->SetTextColor(50,60,100);
//set up a page
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
//insert an image and make it a link
//$pdf->Image('logo.png',10,20,33,0,' ','http://www.fpdf.org/');
//display the title with a border around it
$pdf->SetXY(50,20);
$pdf->SetDrawColor(50,60,100);
$pdf->Cell(100,10,'FPDF Tutorial',1,0,'C',0);
//Set x and y position for the main text, reduce font size and write content
$pdf->SetXY (10,50);
$pdf->SetFontSize(10);
$pdf->Write(5,'Congratulations! You have generated a PDF.');
//Output the document
$pdf->Output('example1.pdf','I');
【问题讨论】:
标签: pdf pdf-generation require fpdf