I donβt know if this will help you, but this is what worked for me very quickly.
I turned the canvas into PNG with:
var datastring = document.getElementById('myCanvas').toDataURL("image/png");
Then I sent this date to the server so that Play would generate the PDF file and I would pass the variable to the Generator PDF
public static void reportPDF(String graphData){ PDF.renderPDF(graphData); }
My pdf code is as follows:
<body> <img width="100%" src="${graphData}"/> </body>
source share