function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yogesh Malbhage 18Yogesh Malbhage 18 

How to use winPrint.Document.write in lightning component.

We are using following code in lightning component client-side controller:
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.
SandhyaSandhya (Salesforce Developers) 
Hi,

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