php - Yii-PDF Extension Gives Error -
so title says , i'm using yii_pdf extension , have follow below steps :
download extension git. see put edpf extension array in cpnfig/main.php. put extenstions file in extenstions folder in directory extensions. download mpdf & html2pdf , set code in vendors folder.and when run below code :
$html2pdf = yii::app()->epdf->html2pdf(); $html2pdf->writehtml($this->renderpartial('analysis_report_pdf', array(), true)); $html2pdf->output();
than given me error
property "cwebapplication.epdf" not defined.
please help me i'm wrong.
updated : see have added in main.php:
'epdf' => array( 'class' => 'ext.yii-pdf.eyiipdf', 'params' => array( 'mpdf' => array( 'librarysourcepath' => 'application.vendors.mpdf.*', 'constants' => array( '_mpdf_temp_path' => yii::getpathofalias('application.runtime'), ), 'class'=>'mpdf', // literal class filename loaded vendors folder /*'defaultparams' => array( // more info: http://mpdf1.com/manual/index.php?tid=184 'mode' => '', // parameter specifies mode of new document. 'format' => 'a4', // format a4, a5, ... 'default_font_size' => 0, // sets default document font size in points (pt) 'default_font' => '', // sets default font-family new document. 'mgl' => 15, // margin_left. sets page margins new document. 'mgr' => 15, // margin_right 'mgt' => 16, // margin_top 'mgb' => 16, // margin_bottom 'mgh' => 9, // margin_header 'mgf' => 9, // margin_footer 'orientation' => 'p', // landscape or portrait orientation )*/ ), 'html2pdf' => array( 'librarysourcepath' => 'application.vendors.html2pdf.*', 'classfile' => 'html2pdf.class.php', // adding yii::$classmap /*'defaultparams' => array( // more info: http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:accueil 'orientation' => 'p', // landscape or portrait orientation 'format' => 'a4', // format a4, a5, ... 'language' => 'en', // language: fr, en, ... 'unicode' => true, // true means clustering input text unicode (default = true) 'encoding' => 'utf-8', // charset encoding; default utf-8 'marges' => array(5, 5, 5, 8), // margins default, in order (left, top, right, bottom) )*/ ) ) ),
i assume place in extension folder. so, it's should that. ext represent protected->extensions folder
//for mpdf 'librarysourcepath' => 'application.ext.mpdf.*', //if placed under vendor 'librarysourcepath' => 'application.ext.vendors.mpdf.*', //for html2pdf 'librarysourcepath' => 'application.ext.html2pdf.*', //or 'librarysourcepath' => 'application.ext.vendor.html2pdf.*',
if set html2pf under vendor folder, it's that
'librarysourcepath' => 'application.vendor.html2pdf.*',
php yii yii-extensions mpdf html2pdf
No comments:
Post a Comment