Print docs in PDF format in Yii

2019-08-19 12:18发布

I have made an application in Yii. Now as per my application requirement I have to make them print in PDF format. I searched over Yii docs but did not got any docs about converting file into printable PDF format. So any help and suggestions will be highly appreciable.

标签: php yii
6条回答
Melony?
2楼-- · 2019-08-19 12:31

Unfortunately this feature is not part of Yii. You can try TCPDF, though. http://www.tcpdf.org/

TCPDF lets you parses your HTML output to PDF document. The PDF document can be output in your server or to the user as a direct download.

查看更多
Evening l夕情丶
3楼-- · 2019-08-19 12:33

Hers the extension to create PDF files. Yii2-PDF

查看更多
Luminary・发光体
4楼-- · 2019-08-19 12:37

I have had great success using fpdf - http://www.fpdf.org/

查看更多
5楼-- · 2019-08-19 12:42

You should search for php libraries to do that. Link to one of them - http://www.tcpdf.org/

查看更多
时光不老,我们不散
6楼-- · 2019-08-19 12:46

I have recently used MPDF for a project. It allows you to convert HTML output into PDF format. If you are looking for something simple this might be what you are looking for. Personally, I find it easier to work with HTML/CSS for layout than PDF boxes. I am not sure just how well it scales with complex layouts, though.

Yii also supports using Zend modules. You can use Zend_Pdf if you so choose.

See this documentation page on how to integrate third-party libraries with your Yii code.

Either way, as has already been mentioned, there are tons of PDF libraries available for PHP.

查看更多
smile是对你的礼貌
7楼-- · 2019-08-19 12:49

Look into WkHtmlToPdf: http://code.google.com/p/wkhtmltopdf/

It uses Webkit's rendering engine to make PDFs from HTML / CSS. It's the best library out there that I've found and I've done a bunch of research.

Edit: Mike on the Yii forum has already built an OO wrapper for WkHtmlToPdf and just released a Yii extension for it.

查看更多
登录 后发表回答