Yii export pdf report

Hi, I’m very new to YII.

I supposed to generate pdf report but I’m getting this error messagebox.

File does not begin with ‘%PDF-’.


I need some help, thanks.

Hello & welcome.

Your code, please?

Hi Bennouna, this is the script from two files.

xpdf.php file from views/trnSaro


$pdf = Yii::createComponent(‘application.extensions.tcpdf.ETcPdf’,

‘P’, ‘cm’, ‘A4’, true, ‘UTF-8’);


$pdf->SetAuthor("Nicola Asuni");

$pdf->SetTitle("TCPDF Example 002");

$pdf->SetSubject("TCPDF Tutorial");

$pdf->SetKeywords("TCPDF, PDF, example, test, guide");





$pdf->SetFont("times", "BI", 20);

$pdf->Cell(0,10,“Example 002”,1,1,‘C’);

$pdf->Output("example_002.pdf", "I");




  • display this View into PDF


public function actionExportPdf()


//$rs = TrnSaro::model()->findAll();

//$this->render(‘export_pdf’, array(‘rs’=>$rs));



Oh ok sorry so this goes into the extension page. I don’t have experience with this one.

Let’s hope someone —that does— stops by.