You need to sign in to do that
Don't have an account?

print a lwc component
Hi,
Can someone please help on how we can add a print button on a lwc component page for Print. And on clicking on this the entire component will be open in a new window for print. Could not find a suitable solution till now. Winodw.print will print the entire wndow. But i want to print only the specific component html. There might be multiple components in the page.
Thanks,
Ashirbad
Can someone please help on how we can add a print button on a lwc component page for Print. And on clicking on this the entire component will be open in a new window for print. Could not find a suitable solution till now. Winodw.print will print the entire wndow. But i want to print only the specific component html. There might be multiple components in the page.
Thanks,
Ashirbad
Accoring to me the only option we have is to put slds-no-print in all the components which you dont want to use when you are printing.
We cant use innerHtml so i dont think as of now its possible.
Thanks,
Nitish Singh
All Answers
Accoring to me the only option we have is to put slds-no-print in all the components which you dont want to use when you are printing.
We cant use innerHtml so i dont think as of now its possible.
Thanks,
Nitish Singh
We can use a window.print to print the whole page. And can have slds-no-print css class added to the sections which need not come in the print.