How can I print a CGridView inside a view?

Hello Yii Community!

I’m editing a custom view in order to print a PDF file using this Extension: application.extensions.MPDF53.mpdf.

but now I would like to print a CGridView but I’m getting this error:

"Object of class CGridView could not be converted to string" and of course, because I do not know how to print the CGridView object in the view… what should I do?

This is my code, I’m just putting the object like a string:

<tr class="odd">

<td> <b>Title</b> </td>

<td> '.$this->widget('zii.widgets.grid.CGridView', array(












			'template' => '{view} {update} {delete} {pdf}',


				'pdf' => array(

				'label'=>'Create PDF Report',

				'url'=>"CHtml::normalizeUrl(array('pdf', 'id'=>\$data->id



			'options' => array('class'=>'pdf'),







Thank you! ;D

Alright, I figured out, my problem is with the PDF Extension, because I have to send the entire String to the PDF function, like this:


$pdf = Yii::createComponent('application.extensions.MPDF53.mpdf');

$html=' bla ';  #some html





How do you guys fix a problem like this one?

I was thinking in ‘rendering’ the view in a html page 1st and then somehow get the source code (html) and send it to the PDF extension function…

What do you think?