We're looking for getting a Lightning component contents printed out. Below is the approach I already have.
using CSS to show hide contents for print:
@media print {
.THIS.divToPrint {
background-color: white;
height: 100%;
width: 100%;
position: fixed;
top: 0;
left: 0;
margin: 0;
padding: 15px;
font-size: 14px;
line-height: 18px;
}
.THIS.hideInPrint{
display: none;
}
}
and using Javascript to perform Print:
performPrint: function(component, event, helper){
window.print();
},
Above is working for certain extent. But it's having below issues.
- if the content overflows, it does not print to multiple pages, I get only one page like a screenshot.
- It prints words like Aura on top left corner, and url on top right corner.
Any suggestion to do this better, fixing these issues, and without creating a separate VF page for it. Appreciate any help.
Thanks.