user1703428
user1703428

Reputation: 47

tinymce editor and its text not printing in print

i want to print a page with tinymce editor and its text.

here is my code..

<script type="text/javascript">
tinyMceEditor("StaffResponsibility,Encourager,Bonus");
function printPage(printpage1, printpage2)
{
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr1 = document.getElementById(printpage1).innerHTML;
var newstr2 = document.getElementById(printpage2).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr1+newstr2+footstr;
window.print();
document.body.innerHTML = oldstr;
location.reload();
return false;
}
</script>  

<div style="float: right"><a href="javascript:void(0)" onclick="printPage('pnlMainHeader','div_print');"><img src="<?=$this->baseUrl('/images/icons/small/print.png')?>" title="Print" alt="Print" /></a></div>
<div id="div_print">
<?=$this->form->StaffResponsibility?>
<div class="clear10"></div>
<?=$this->form->Encourager?>
<div class="clear10"></div>
<?=$this->form->Bonus?>
<div class="clear10"></div>
</div>  

when i click the print icon i should print tinymce editor with text.but here i am not getting editors and its text..

regards
uday

Upvotes: 1

Views: 1284

Answers (1)

Thariama
Thariama

Reputation: 50832

You will need to execute the following on click

onclick="tinymce.triggerSave(); $( '#'+tinymce.editors.get(0).id) ).css('display','block');printPage('pnlMainHeader','div_print');"

Upvotes: 1

Related Questions