我的代码非常简单:
header('Content-type: application/pdf');
header("Content-Disposition: attachment; filename=\"tesat.pdf\"");
$pdf1 = new Zend_Pdf();
$p1=$pdf1->newPage(Zend_Pdf_Page::SIZE_A4);
$p1->drawLine(10, 10, 40, 40);
echo $pdf1->render();
die;我有Acrobat阅读器v9
ZF v1.11
错误消息:“此文件无法打开,因为它没有页面”
我遗漏了什么?
发布于 2010-12-16 00:55:20
您必须将页面添加到pdf:
$pdf1->pages[] = $p1; 这里有一个关于Zend_PDF http://devzone.zend.com/article/2525的不错的教程
发布于 2010-12-16 00:53:59
要从the manual添加页面,您应该创建页面,对其进行修改,然后将其添加到您的pdf中。
header('Content-type: application/pdf');
header("Content-Disposition: attachment; filename=\"tesat.pdf\"");
$pdf1 = new Zend_Pdf();
$p1 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$p1->drawLine(10, 10, 40, 40);
$pdf1->pages[] = $p1;
echo $pdf1->render();应该行得通。
https://stackoverflow.com/questions/4452450
复制相似问题