Print Html View In Yii

Download Extension

Using the below link download the extension to take the print of html [Take print What you see].

Click here to download

After download, Add the extension into follwoing directory “protected/extension/mPrint/mPrint”

Print Table
I added sample code to print the some view content

       $this->widget('ext.mPrint.mPrint', array(
            'title' => 'User Result',        //the title of the document. Defaults to the HTML title
            'tooltip' => 'User Result',    //tooltip message of the print icon. Defaults to 'print'
            'text' => 'Print Results', //text which will appear beside the print icon. Defaults to NULL
            'element' => '#resultprint',      //the element to be printed.
            'exceptions' => array(     //the element/s which will be ignored
            'publishCss' => true,       //publish the CSS for the whole page?
            'id' => 'resultprintid',
            'style'=>'float: right; padding: 5px; margin-top: -5px;'                       
 <div id="resultprint">
echo"<div class='title'><h3>Yii User Results</h3></div>";

Leave a Reply

Your email address will not be published. Required fields are marked *