Yii 1.1: printout

Produces print output for selected html elements on a page

This extension produces print output for selected html elements on a page with desired css styles, multiple selection is allowed



  • Yii 1.0.5


  • Copy all the 'print' catalogue under /protected/extensions


  • Add button(s) to your view page (several times, if needed - as many as you wish!):


   <?php $this->widget('application.extensions.print.printWidget', array(


where possible properties with their default values are:

  • 'cssFile' => 'print.css' string css file name. It's tuned for 'printedElement' => '.dataGrid' by default. In case you change 'printedElement', you MUST edit this file, and the content of this file is absolutely up to you!
  • 'coverElement' => '#page' string css selector (understanding by jQuery $()-function) of the element, which covers all inside the 'body', it's a 'div' with id='page' by default
  • 'printedElement' => '.dataGrid' string css selector (understanding by jQuery $()-function) of the element to be printed out, by default it's a 'table' with class='dataGrid' (selection result may be not single!)
  • 'title' => '' string the title of the printed page
  • 'htmlOptions' => array() array htmlOptions array - standard for Yii

Change Log

July 5, 2009

  • Initial release.

Total 7 comments

#15458 report it
beks at 2013/11/12 01:42pm
Printout not Good

Its not good coz it does'nt let be print which header and which footer.Help me out

#11010 report it
Kollipara Rama Krishna at 2012/12/10 07:13am
Solution for anchor tag

Hii frnds I am using these widget it is working fine but in my page if anchor tag is present it also prints its url(href) also,for this I change its php file(printWidget.php)

after the line "clonedEl = \$(arrayEl[i]).clone();"

add this line "$(clonedEl).find('a').removeAttr('href');"

Please share if you modify this widget like this.

#4471 report it
nafa at 2011/07/12 03:38am
2 input in the title

is it ok if i want to put 2 input in the header? i try to display image (it work) and also want to put some text.. is there any way to do it?

#3736 report it
nafa at 2011/05/03 09:39pm

This extension work find with me.. but how can i change the picture of the printer itself (it too small) and modify the layout of the printed page?

#2143 report it
saebaryo at 2010/11/17 09:24am

you can add some tag html in your view.

<div id="yang_mau_diprint">
    $this->widget('application.extensions.print.printWidget', array(                   
                   'cssFile' => 'print.css',
<!-- this sample php code -->
<?php $this->widget('zii.widgets.grid.CGridView', array(

don't forget close your tag again :D

#321 report it
DarkNSF at 2010/07/09 12:22pm
Works Great!

I added a tag to add text to the print iamge link.

#986 report it
CoLT at 2010/01/14 08:20pm
Good extension to Yii community

Please please make an example code printing multiple elements eg. header + .dataGrid.

Selection does not work.

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: kvl
  • Category: Others
  • Votes: +5
  • Downloaded: 3,339 times
  • Created on: Jul 5, 2009
  • Last updated: Jul 5, 2009