0

i am trying to export the few tables and charts to pdf using mpdf, but only tables are displayed in pdf chart section is showing blank. can anyone help??

i have tried below code.

$str = $this->load->view('admin/ticketing/ticketing_report_pdf',$arrData,true);
$mpdf->AddPage('','NEXT-ODD','','1','off');
$mpdf->use_kwt = true;
$mpdf->shrink_tables_to_fit=1;
$mpdf->useDefaultCSS3 = true;
$mpdf->allow_charset_conversion = true;
$mpdf->charset_in = 'iso-8859-4';
$mpdf->WriteHTML($str);
$mpdf->Output($pdfFilePath,'D');

and chart is generated using js..

Cs Student
  • 61
  • 1
  • 7
  • mpdf has very minimal JavaScript support, so it's not going to handle a JS charting library very well. You may want to consider using something like wkhtmltopdf or [Selenium Webdriver](https://www.amcharts.com/docs/v4/tutorials/automating-report-generation-using-selenium-webdriver/) (the tutorial uses node, but a [php binding exists](https://github.com/php-webdriver/php-webdriver) if you prefer) – xorspark May 05 '20 at 15:10

1 Answers1

0

use dom-to-image

library to convert chart to image then send image html with your tables

jobayersozib
  • 401
  • 2
  • 7