Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP中的Zend PDF问题创建新页面_Php_Pdf_Zend Pdf - Fatal编程技术网

使用PHP中的Zend PDF问题创建新页面

使用PHP中的Zend PDF问题创建新页面,php,pdf,zend-pdf,Php,Pdf,Zend Pdf,我已将pdf的内容作为文本存储在数据库中。 我想用数据库中的内容创建包含更多页面的pdf文件。 以下是我目前的代码: $pdf = new Zend_Pdf(); foreach ($pdfLabels as $label){ $pdf->pages[] = $label->getPdfContentFromDb(); // here i have the content from the db } $finalContent =

我已将pdf的内容作为文本存储在数据库中。 我想用数据库中的内容创建包含更多页面的pdf文件。 以下是我目前的代码:

    $pdf = new Zend_Pdf();
    foreach ($pdfLabels as $label){
        $pdf->pages[] = $label->getPdfContentFromDb();  // here i have the content from the db 
    }
    $finalContent = $pdf->render();
但我面临着一个致命的错误:

Fatal error: Uncaught Error: Call to a member function render() on string in.  ...zendframework1/library/Zend/Pdf.php:733
我确信我尝试创建一个新的pdf页面并插入一些内容的方法是错误的,所以请您提供建议

我也在查看这篇文章,但不确定我应该如何继续包含我的内容

谢谢

我找到了修复方法:

        $pdf = new Zend_Pdf();
        foreach ($pdfLabels as $label){
            $pdfContent = new Zend_Pdf($label-> getPdfContentFromDb());
            $pdf->pages[] = clone $pdfContent->pages[0];
        } 
        $finalContent = $pdf->render();
我希望它能帮助别人