【问题标题】:Symfony2 Knp-snappy to generate PDF from a twig view that contain heichartsSymfony2 Knp-snappy 从包含 heicarts 的树枝视图生成 PDF
【发布时间】:2015-05-31 17:47:42
【问题描述】:

我想从包含高度图的树枝视图生成 PDF 文件 高度图不显示在 pdf 文件中。 为什么 ?任何建议

$html = $this->render('AcmequizBundle:Resultat:show.html.twig', array(
            'entity'      => $entity,
            'chart'=>$ob
        ));


return new Response(
    $this->get('knp_snappy.pdf')->getOutputFromHtml($html,array('encoding'=>'UTF-8','enable-javascript' => true,'images' => true)),
    200,
    array(
        'Content-Type'          => 'application/pdf',
        'Content-Disposition'   => 'attachment; filename="Rapport.pdf"'
    )
);

【问题讨论】:

    标签: symfony pdf


    【解决方案1】:

    Highcharts 是一个 JS 库,它使用客户端的浏览器生成图表。您应该在服务器端以任何图像格式生成图表,并将其包含在您的 PDF 树枝模板中。

    关于服务器端图表生成的一些信息:http://www.highcharts.com/component/content/article/2-articles/news/52-serverside-generated-charts

    【讨论】:

      猜你喜欢
      • 2015-07-23
      • 1970-01-01
      • 2014-03-28
      • 2015-05-15
      • 2014-09-29
      • 2013-11-22
      • 2015-04-22
      • 1970-01-01
      • 2019-06-30
      相关资源
      最近更新 更多