Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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
Loops 如何在foreach循环中以zend PDF生成新页面_Loops_Pdf_Zend Framework - Fatal编程技术网

Loops 如何在foreach循环中以zend PDF生成新页面

Loops 如何在foreach循环中以zend PDF生成新页面,loops,pdf,zend-framework,Loops,Pdf,Zend Framework,请解释如何为foreach循环内容生成pdf格式的新页面 $pdf = new Zend_Pdf(); $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4); $items = array(); foreach ($items as $item) { $page->setFont($font, 9) ->setFillColor(Zend_Pdf_Color_Html::color('#000000'))

请解释如何为foreach循环内容生成pdf格式的新页面

$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$items = array();
foreach ($items as $item) {
    $page->setFont($font, 9)
         ->setFillColor(Zend_Pdf_Color_Html::color('#000000'))
         ->drawText('Text 1', 0, 800);
}
$pdf->pages[] = $page;
$pdf->save('wishlist.pdf');

您必须使用以下代码在pdf文件中添加新的空白页

$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4); 
然后分配给

$pdf->pages[] = $page;