DOMPDF Help

Hi,

Need help using DOMPDF for PDF generation, stuck real bad.

Tried using the class from here : http://www.yiiframework.com/forum/index.php?/topic/7256-to-pdf-or-not-to-pdf/page__p__36748__hl__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

Put dompdf in extensions and try this


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');

        }



Thanks a ton dude. Works like a charm.

you’re welcome :)

hi,


Yii::import('ext.Pdf',true);

what it means … ???

how we add header on each page of pdf document?

i solved with the help of this article: