[Chartjs]-How to add ChartJS code in Html2Pdf to view image

2👍

as the error message hints for: you’d have go to Html2Pdf on Github and create a new issue there; in order to have tag canvas added into the next one release of the library – or try to use something else than a canvas to render the chart; other charting-libraries would also work with tag div or svg.

well, see issue 372 …the author does not intent to add tag canvas.

therefore, you could only work around, eg. with phantomJS, to create a screenshot of the canvas and then use that as static image resource, in order to render it to PDF.

1👍

I think your problem is not with HTML2PDF but the error is with the events sequence to create the HTML2PDF. What I understand doing events as:

1.  Loading PHP Code
2.  Loading according to PHP and creating Charts/Canvas through JS
3.  Pringing HTML2PDF Output through PHP Code

The real problem is that Step No.3 is not waiting for completion of Step No.2. Thus, you have to create a trigger/event to start step No.3 on completion of Step No.2. Generally the HTML2PDF are created through JS as under:

Leave a comment