如何在foreach循环中在zend PDF中生成新页面 [英] How to generate new page in zend PDF in foreach loop

查看:37
本文介绍了如何在foreach循环中在zend PDF中生成新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

please explain how can generate new pages in pdf for foreach loop content

$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 文件中添加新的空白页.

You have to use the below code to add new blank pages in your pdf file.

$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4); 

然后分配给

$pdf->pages[] = $page;

这篇关于如何在foreach循环中在zend PDF中生成新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆