我想在我的本地主机中设置FPDI,但它给了我一个错误。
Fatal error: Class 'FPDF' not found in C:\wamp\www\book\fpdf_tpl.php on line 20这是我所做的:
我去了download page,我下载了两个包(FPDF_TPL和FPDI)并将它们解压到我的本地主机中。
然后我做了一个example page:
<?php
require_once('fpdf.php');
require_once('fpdi.php');
// initiate FPDI
$pdf = new FPDI();
// add a page
$pdf->AddPage();
// set the source file
$pdf->setSourceFile("PdfDocument.pdf");
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at point 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx, 10, 10, 100);
// now write some text above the imported page
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(30, 30);
$pdf->Write(0, 'This is just a simple text');
pdf->Output();我按网站说的做了,但我犯了一个错误:
Fatal error: Class 'FPDF' not found in C:\wamp\www\book\fpdf_tpl.php on line 20我已经搜索了错误代码,但我找不出它。
有没有使用FPDI的经验?
发布于 2013-11-05 17:08:13
您必须在页面Download中下载该库并将其解压缩到您的文件夹中。那么代码应该可以工作了。确保您为require_once输入了正确的路径。
发布于 2013-11-25 12:42:29
从http://www.fpdf.org/en/download.php下载fpdf lib,
使用最新版本的目录: require_once('your_dir/fpdf17/fpdf.php');
发布于 2016-05-04 22:03:57
将下面一行添加到您的作曲家中。
"require": {
"setasign/fpdi-fpdf": "1.6.1"
}并使用以下代码更新编写器。
composer update setasign/fpdi-fpdf删除你需要的函数行,并添加到下面的行。您将获得一个输出。
include 'vendor/autoload.php';https://stackoverflow.com/questions/19784994
复制相似问题