You need to sign in to do that
Don't have an account?
Yogesh Malbhage 18
How to use winPrint.Document.write in lightning component.
We are using following code in lightning component client-side controller:
But is giving an exception as "Cannot read property 'write' of undefined". Please help me through this.
var headerCmp = component.find("main-container").getElement(); console.log("headerCmp:"+headerCmp.innerHTML); var WinPrint = window.open('', 'WinPrint', 'left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0'); WinPrint.document.write(headerCmp.innerHTML); WinPrint.document.close(); WinPrint.focus(); WinPrint.print(); WinPrint.close();
But is giving an exception as "Cannot read property 'write' of undefined". Please help me through this.
This idea has been raised check below link.
https://success.salesforce.com/ideaView?id=0873A000000TsNQQA0
https://developer.salesforce.com/forums/?id=9060G000000MTQ2QAO
https://developer.salesforce.com/forums/ForumsMain?id=9060G000000MT2oQAG
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
Sandhya