【问题标题】:Is it possible that graph generated by amcharts 3 can be exported to PDF using mpdf?是否可以使用 mpdf 将 amcharts 3 生成的图形导出为 PDF?
【发布时间】:2020-05-05 08:56:07
【问题描述】:

我正在尝试使用 mpdf 将少数表格和图表导出为 pdf,但只有表格显示在 pdf 图表部分显示为空白。谁能帮忙??

我试过下面的代码。

$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');

并且图表是使用js生成的..

【问题讨论】:

  • mpdf 对 JavaScript 的支持非常少,因此它不能很好地处理 JS 图表库。您可能需要考虑使用 wkhtmltopdf 或 Selenium Webdriver 之类的东西(本教程使用节点,但如果您愿意,可以使用 php binding exists

标签: php codeigniter amcharts mpdf


【解决方案1】:

使用dom-to-image

将图表转换为图像的库,然后将图像 html 与您的表格一起发送

【讨论】:

    猜你喜欢
    • 2013-11-20
    • 1970-01-01
    • 2019-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-20
    • 1970-01-01
    • 2019-04-02
    相关资源
    最近更新 更多