[Chartjs]-Chartjs does not show on pdf in yii2 despite showing in html view

3👍

You can see in the MPDF docs: https://mpdf.github.io/html-support/html-tags.html
that canvas and script tags are not supported. in the case of charts, most use canvas, you can see that chartsjs also uses canvas to render its charts. https://www.chartjs.org/docs/latest/general/responsive.html

Most PDF generator does not support rich HTML and charts.

I suggest you use phantomJS for generating pdf.

http://phantomjs.org/

http://jonnnnyw.github.io/php-phantomjs/

for PDF: http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/#output-to-pdf

Leave a comment