Yii-PDF shows blank page on linux

Hi guys.

The generation of the pdf using the extension yii was working perfectly on my local machine (Windows 7, php version 5.3.10), but when I moved the application to the server (Linux 5.2.6-1 + lenny16) presents a blank screen after running this line:


$ mPDF1 = Yii :: app () -> EPDF-> mpdf ();

Even enabling all php errors, does not show any error. Someone tell me what might be happening?

Thank you!

Hi Felipe,

Did you try in Google Chrome? (sometimes the Firefox (with Acroread plugin) shows a blank page on PDF files).

[]'s

Personally here’s what I have that is working in Mac OS X and shared-hosting Linux:

config/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',

        ),

      ),

    ),

Controller (e.g.):


$PDF = Yii::app()->ePdf->mpdf('', 'A4', 8, '', 10, 10, 10, 10, 5, 5);

Hi rodza. Thank you for your reply!

All browsers the same thing, but the problem is certainly not that it worked perfectly locally.

Well, have you ever tried to create a simple "hello world"

If you are using the "WriteHTML" method, you have to make sure the HTML is valid.

In any case, here are the settings that work in one of my projects:

In my config/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', // the literal class filename to be loaded from the vendors folder

                                'format' => 'A4',

                                'default_font_size' => 1,

                            ),  

                        ),

                ),



In my controller:




        public function actionPrintAllPDF()

        {

            

            ini_set('max_execution_time',360);

            ini_set('memory_limit', '128M');


            

            $mPDF1 = Yii::app()->ePdf->mpdf('','A4');            

            

            $mPDF1->SetHTMLHeader('<h3 style="text-align: center;">'.mb_strtoupper(str_replace('Administração','',Yii::app()->name),'UTF-8').'</h3>');

            

            // como temos poucos registros aqui, usamos findAll() sem problemas de ficarmos sem memória. <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/smile.gif' class='bbc_emoticon' alt=':)' />   

            $records = DiamPapers::model()->findAll();

            $html = '';

            

            //carrega a folha de estilo

            $stylesheet = file_get_contents(Yii::getPathOfAlias('webroot.css') . '/bootstrap_print.css');

            $mPDF1->WriteHTML($stylesheet, 1);        

            

            foreach($records as $record){

                $html .= $this->renderPartial('//diamPapers/print', array('model'=>$record),true);

            }

                        

            $mPDF1->WriteHTML($html, false);

                

            # Envia o PDF

            $mPDF1->Output();

        }



Same thing :(

Does the problem is not the version of php I’m running on the server? I do not know if this component has some limitation in this regard.

The extension needs PHP 5.3. For anterior versions, see the comment. I’ve done it on one 5.2 shared host and it works:

http://www.yiiframework.com/extension/pdf/#c6934

THANK YOU SO MUCH AGAIN FELLA! :D

I made adjustments to work on versions below 5.3 and it worked beautifully!

De nada, um prazer :lol:

In fact, I didn’t read carefull your first post:

Achei que você fosse gringo pow! (Location: Morocco).

Valeu mesmo cara, tudo de bom.

Sim, eu sou de Marrocos, mas eu falo um pouco o Português

Hello.

I’m having the same problem: I have PHP 5.2 and it shows empty PDFs.

Tried to find the correction’s mentioned, but couldn’t find them anywhere.

What should I change if I’m using yii-pdf-0.3.2.zip?

Thanks