0

I'm trying to build an header generator for pdf worksheets.

My choice of technologies were: FPDF and FPDI

Now, I'm transistioning to TCPDF and FPDI, because the powers that be have decided we need water marks (transparencies).

According to the FPDI website, switching is as easy as changing all your require/include statements to say tcpdf.php instead of fpdf.php but in my code below:

//... Code to generate appropriate Graph ...
PDFGenHelper::saveIMG($graph,$imgfilepath);
$filename = "template.pdf";
$pdf = new FPDI();
$pdf->AddPage();

$pdf->setSourceFile($filename);
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);

$pdf->Image($imgfilepath, 168, 13, 35, 65);

$pdf->Write(5, "This is just a simple text"); //This line

$pdf->Output($dircache.$userID.'_'.$excerciseID.'_package.pdf', 'F');

Seems to generate an error that says: Warning: Division by zero in Appropriate directory stuff here/lib/fpdf/fpdf.php on line 819

I've removed all the references to fpdf in my code but it seems to still be coming up with that.

Also, when I try to print to the PDF using the inherited methods from FPDF:

$pdf->SetFont('Arial','B',25);
$pdf->Cell(40,10,'Hello World!');

This will generate text. In addition the FPDI website says FPDI has a Dependency on FPDF_TPL file which looking into the file tells me it extends FPDF.

So to my question: How do you configure FPDI to work with TCPDF instead of FPDF?

4

1 回答 1

0

如果在 lib/fpdf/fpdf.php 中出现错误,那么您在 TCPDF 之前仍然需要 fpdf.php。

另外:如果只是缺少透明度,请使用脚本部分中的AlphaPDF

于 2011-08-30T13:12:10.893 回答