0
A
回答
0
我在這裏張貼簡單的例子來生成PDF
讓我們與說明行動Zend_Pdf一個簡單的例子開始:
<?php
// include auto-loader class
require_once 'Zend/Loader/Autoloader.php';
// register auto-loader
$loader = Zend_Loader_Autoloader::getInstance();
try {
// create PDF
$pdf = new Zend_Pdf();
// create A4 page
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
// define font resource
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
// set font for page
// write text to page
$page->setFont($font, 24)
->drawText('That which we call a rose,', 72, 720)
->drawText('By any other name would smell as sweet.', 72, 620);
// add page to document
$pdf->pages[] = $page;
// save as file
$pdf->save('example.pdf');
echo 'SUCCESS: Document saved!';
} catch (Zend_Pdf_Exception $e) {
die ('PDF error: ' . $e->getMessage());
} catch (Exception $e) {
die ('Application error: ' . $e->getMessage());
}
?>
讓我知道如果我能幫助你更多。
相關問題
- 1. 如何實現在Zend框架模型
- 2. 在zend框架工程中實現cron
- 3. 在ZEND框架中實現SAAS
- 4. zend框架中簡單的pdf下載功能1.11
- 5. 如何使用zend框架創建PDF?
- 6. 如何在Zend框架中實現連接mysql查詢模型
- 7. 如何在zend框架1中實現ESAPI?
- 8. Zend框架PDF多問題
- 9. Zend框架2 PDF生成
- 10. Zend框架記住我的功能
- 11. 問題與Zend框架的功能getBaseUrl()
- 12. Zend框架添加AWS S3功能?
- 13. 如何實現MVC在我的Zend框架
- 14. Zend框架2 - PDF - 加載PDF模板
- 15. 使用Zend框架實現MVC
- 16. Zend框架和pthreads庫實現
- 17. 在Zend框架中實現虛榮URL(如http://facebook.com/JohnDoe)?
- 18. 不能在Zend框架
- 19. 如何Zend框架
- 20. 如何在Zend框架
- 21. 如何在Zend框架
- 22. 如何在Zend框架
- 23. Zend框架2不能在Zend框架檢索會議
- 24. 如何使用相同的功能Zend框架
- 25. 如何使用Zend框架2實現jquery自動完成?
- 26. 如何在我的網站上實現PDF/PPT查看功能?
- 27. 在zend框架中操作其他模塊的功能2
- 28. 如何在Cucumber中實現BeforeSuite功能
- 29. 如何在Flex中實現AJAX功能
- 30. 如何在Typo3中實現新功能?