问题
Is it possible to print just the contents of <rich:modalPanel
>?
回答1:
Wrap all the content of rich:modalpanel in a div then use following javascript snippet to do your work, of course it is not standard. add a print button in richmodal panel on click call this function of javascript
function PrintContent()
{
var DocumentContainer = document.getElementById('divtoprint');
var WindowObject = window.open("", "PrintWindow",
"width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
setTimeout(function(){
WindowObject.focus();
WindowObject.print();
WindowObject.close();
},6000);
}
source: http://www.isolutionteam.co.uk/printing-contents-of-a-div-using-javascript/
来源:https://stackoverflow.com/questions/3958510/print-contents-of-modalpanel