: This article mainly introduces Yii integration HTML2PDF. if you are interested in the PHP Tutorial, please refer to it. Http://html2pdf.fr/en/default (Class Library home page, click the top github, you can download Class Library)
After the download is completed, it is used in Yii. Because its file structure does not conform to the Yii automatic loading method, we manually load the file. In the Yii directory structure, modify backend/web/index. php and add $ vendorDir = dirname (_ DIR _). '/vendor ';
$ Application = new yii \ web \ Application ($ config );
Yii: $ classMap ['html2pdf '] = $ vendorDir.'/HTML2PDF/html2pdf. class. php'; // add this class before yii is started
$ Application-> run ();
Usage: In a controller of yii,
Use HTML2PDF;
....
Try
{
$ Html2pdf = new HTML2PDF ('P', 'A4 ', 'en', true, 'utf-8', array (15, 5, 15, 5 ));
$ Html2pdf-> setDefaultFont ('javierg'); // This is a Chinese font library, which needs to be manually downloaded in webERP/schemdes/tcpdf/fonts/directory, http://sourceforge.net/projects/web-erp/
$ Html2pdf-> pdf-> SetDisplayMode ('fullpage ');
$ Html2pdf-> writeHTML ($ plain content );
$ Filename = $ orderId. 'hangzhou ';
$ Html2pdf-> Output ($ filename );
}
Catch (HTML2PDF_exception $ e ){
Echo $ e;
Exit;
}
Last PDF to HTML website http://www.htmlpublish.com/convert-pdf-to-html/
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above introduces Yii integration HTML2PDF, including some content, hope to be helpful to friends who are interested in PHP tutorials.