繁体   English   中英

为什么 FPDF 的 useImportedPage 不适用于 PHP 代码

[英]Why FPDF's useImportedPage doesn't work for PHP code

使用useImportedPage()生成标签时收到以下错误...

ErrorException [致命错误]:调用未定义的方法 FPDI::useImportedPage()。

但是当我注释掉$pdf->useImportedPage($tplIdx, 10, 10, 100); 并取消注释行$pdf->useTemplate($tplidx); 它工作正常。

我导入的PDF是1.4版本。

关于为什么useImportedPage()不起作用的任何建议?

    $this->auto_render  = false;
    $this->template = NULL;
    $offset = 0;

    require_once('assets/vendors/fpdf/fpdf.php');
    require_once('assets/vendors/fpdi/fpdi.php');

    $pdf = new Fpdi();

    $pdf->addPage();

    $pdf->setSourceFile('TEST.pdf');

    $tplidx = $pdf->importPage(1);

    $pdf->useImportedPage($tplIdx, 10, 10, 100);
    //$pdf->useTemplate($tplidx);

    $pdf->SetFont('Arial');
    $pdf->SetFontSize(5);
    $pdf->SetXY(5, 5);
    $pdf->Text(3.5, 5, $_POST['A']);
    $pdf->Text(3.5, 8.5, $_POST['B']);
    $pdf->Text(21, 5, $_POST['C']);
    $pdf->Text(21, 8.3, $_POST['D']);
    $filename='SECONDTEST/'.$_POST['A'].'.pdf';
    $pdf->Output($filename, 'F');

您使用的是过时的 1.x 版本。 在 FPDI 2 中添加了useImportedPage()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM