This extension produces print output for selected html elements on a page with desired css styles, multiple selection is allowed
Documentation ¶
Requirements ¶
- Yii 1.0.5
Installation ¶
- Copy all the 'print' catalogue under /protected/extensions
Usage ¶
- Add button(s) to your view page (several times, if needed - as many as you wish!):
[php]
<?php $this->widget('application.extensions.print.printWidget', array(
'property1'=>'value1',
'property2'=>'value2'));
?>
[php]
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.
User Contributed Notes 7
Works Great!
I added a tag to add text to the print iamge link.
Good extension to Yii community
Please please make an example code printing multiple elements eg. header + .dataGrid.
Selection does not work.
example
you can add some tag html in your view.
<div id="yang_mau_diprint"> <?php $this->widget('application.extensions.print.printWidget', array( 'cssFile' => 'print.css', 'printedElement'=>'#yang_mau_diprint', ) ) ); ?> <!-- this sample php code --> <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'pengungsimerapi-grid', 'dataProvider'=>$model->search(), 'filter'=>$model, 'columns'=>array( array( 'name'=>'nama', 'type'=>'raw', ), array( 'name'=>'alamat', 'type'=>'raw', ), ), )); ?>don't forget close your tag again :D
hello
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?
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?
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.
Printout not Good
Its not good coz it does'nt let be print which header and which footer.Help me out
Leave a comment
If you have any questions, please ask in the forum instead.
Join the conversation to share a note.