Data to html format and print pdf


I have created one page in which showing data in ag-grid. Now, I want to show grid data in particular format and generate pdf.

So, I need the missing links. i.e. how to send data to html template. Ans also calling generate pdf on that.