Hi,
Need help using DOMPDF for PDF generation, stuck real bad.
Tried using the class from here : http://www.yiiframew..._pdf#entry36748
Not getting any popups and no PDF getting generated anywhere.
Can anyone help me going about including this class withing Yii Framework.
Thanks
Page 1 of 1
DOMPDF Help PDF Generation using DOM PDF
#2
Posted 17 August 2011 - 11:51 AM
Put dompdf in extensions and try this
then when you wanna create pdf put this in controller (for example):
class Pdf {
public function pdf_create($html, $filename, $paper, $orientation)
{
require_once("dompdf/dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper($paper,$orientation);
$dompdf->render();
$dompdf->stream($filename.".pdf");
}
}then when you wanna create pdf put this in controller (for example):
public function actionPrint($id)
{
Yii::import('ext.Pdf',true);
$model = $this->loadModel($id);
$this->pdf = new Pdf();
$html = $this->renderPartial('_print', array('model'=>$model), true, true);
$this->pdf->pdf_create($html, '{name of pdf file}', 'a4', 'portrait');
}
#5
Posted 04 June 2012 - 09:43 AM
hi,
what it means ...
Yii::import('ext.Pdf',true);what it means ...
Radamés Galvao
PHP with Yii devel.
PHP with Yii devel.
Share this topic:
Page 1 of 1

Help












