D3 chart in pdfmake using Ionic-React

I want to append chart to DOM and catch image of that chart and put that in PDF generated by pdfmake.
The condition is graph need to be generated but not to be shown on UI, and directly to be put on PDF.
I dont know how to add chart in react code on the go and add that to my pdf??