我正在为我的项目使用ZendFramwork 1.7,现在我想以PDF格式绘制文字,但是当我的数据太长时,我需要打破行。
这是我从数据库传递的数据,即var_dump
这是我的问题结果
我希望当我的网站名称(site_Name
)太长或太长时,它会自动断线。怎么做呢?欢迎任何样本网站/链接。
这是我的代码
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$base = realpath(APPLICATION_PATH . '/../public');
$image = Zend_Pdf_Image::imageWithPath($base . "/images/logo_login.png");
$page->drawImage($image, 60, 547, 80, 563);
$page->setLineWidth(0.2)
->drawLine(60, 520, 790, 520);
$page->setFont($font, 11)
->drawText("Site", 80, 550)
->drawText("Date " . date("Y-m-d"),705, 550);
$i = 0;
$pages = 500;
$perline = 20;
foreach ( $getValueSiteView as $key => $value) {
if ($i == 0) {
$line = $pages;
} else {
$line = $pages - ($i * $perline);
}
$name = $value["site_Name"];
$add = $value["site_Adresse1"];
$city = $value["site_City"];
$Com_Name = $value["Com_Name"];
$Com_Add = $value["Com_Address1"];
$Com_tel = $value["Com_Telephone"];
$page->setFont($font, 9)
->drawText($namee, 60, 530)
->drawText($vil, 120, 530)
->drawText($Adre, 210, 530)
->drawText($comNom, 450, 530)
->drawText($ComTel, 600, 530)
->drawText($conAdd, 700, 530);
$page->setFillColor(Zend_Pdf_Color_Html::color('#999999'))
->drawText($name, 60, $line)
->drawText($city, 120, $line)
->drawText($add, 210, $line)->drawText($Com_Name, 450, $line)
->drawText($Com_tel, 600, $line)
->drawText($Com_Add, 700, $line);
$i++;
}
提前致谢。