This is my view code
<?php
$this->widget('application.extensions.print.printWidget', array(
'cssFile' => 'print.css',
'coverElement' => '#wrapper',
'printedElement'=>'#summary',
)
);
?>
<div id="summary">
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'name',
'date_created',
'medical_treatment',
'remarks',
),
)); ?>
<br><br>
<center>____________________________</center>
<center>Doctor's Signature</center>
</div>
my controller/action
public function actionPrescription($id)
{
$this->render('printprescription', array(
'model'=>$this->loadModel($id),
));
}
I want to print only the content of div id="summary" the extension does let me do it but it prints out the entire page first with the header and footer
I thought the coverElement could remove it but I guess not?
can anyone help?
Adding print media in CSS should have helped. You can try adding selectors for header and footer directly into extension code.
echo CHtml::css("
.printWidgetScreenCover {display: none;}
.printWidgetPrintedElement {display: block; margin: 20px;}
#header {display: none;}
#footer{display: none;}
",
"print"
);