Articles in this section
Category / Section

How to print the JavaScript Grid with custom heading?

2 mins read

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

Print custom heading in Javascript Grid

You can find the sample here

Javascript(ES5) Sample

 

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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied