How to print the JavaScript Grid with custom heading?
This knowledge base explains how to print the JavaScript Grid with a custom heading. While printing the Grid, you can apply customization by using beforePrint event of the Grid. In this demo, we have added a custom element (to display custom heading with Grid) with Grid component through beforePrint event of the Grid.
function beforePrint(args) { var img = document.createElement('img'); img.src = 'https://cdn-icons-png.flaticon.com/512/912/912214.png'; img.height = 60; img.width = 60; img.style.padding = '10px'; var div = document.createElement('div'); div.innerHTML = 'Employee Details<br> From 1992'; div.style.position = 'absolute'; div.style.marginLeft = '600px'; div.style.marginTop = '10px'; div.style.fontWeight = 'bold'; div.style.fontSize = '15px'; args.element.insertBefore(img, args.element.childNodes[0]); // Here, you can append your title content. args.element.insertBefore(div, args.element.childNodes[0]); // Here, you can append your title content. }
Output
You can find the sample here
Documentation
https://ej2.syncfusion.com/javascript/documentation/api/grid/#beforeprint
https://ej2.syncfusion.com/javascript/documentation/grid/print/
Conclusion
I hope you enjoyed learning about how to print the JavaScript Grid with custom heading
You can refer to our JavaScript Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Grid example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!