【发布时间】:2012-10-10 17:36:56
【问题描述】:
我有以下数组,其中包含标题及其各自的图像。
Array
(
[0] => Array
(
[title] => Title1 : Introduction
[image] => http://path/to/file.png
)
[1] => Array
(
[title] => Title2 : Description
[image] => http://path/to/file.jpg
)
.
.
.
//and so on
)
我想创建它的 PDF 格式: page1 上的 Array[0] 内容: 顶部(对齐:中心)和下方的标题 图片(对齐:居中,高度:400,宽度:400)
与第 2 页上的数组 [1] 内容类似...
我正在这样做,但没有取得任何成功。检查下面的代码:
<?php
include_once ('class.ezpdf.php');
$feeddata = unserialize(urldecode($_GET['feed']));
$pdf = & new Cezpdf('LETTER');
$image = imagecreatefrompng("background.png");
$pdf->addImage($image, 0, 0, 611);
$pdf->selectFont("fonts/Helvetica.afm");
$pdf->setColor(0 / 255, 0 / 255, 0 / 255);
$pdf->setLineStyle(0.5);
$pdf->line(80, 615, 540, 615);
$pdf->setStrokeColor(0, 0, 0);
$pdf->setColor(0 / 255, 0 / 255, 0 / 255);
$pdf->addText(30, 16, 8, "<b>Created " . date("m/d/Y"));
foreach($feeddata as $data){
$pdf->addText(80, 620, 10, $data['title']);
$pdf->addImage($data['image'], 0, 0, 611);
}
$pdf->ezStream();
?>
谁能告诉我该怎么做……谢谢
【问题讨论】: