【问题标题】:no assets when generating jpg with KnpSnappyBundle使用 KnpSnappyBundle 生成 jpg 时没有资产
【发布时间】:2012-05-18 13:30:09
【问题描述】:

这似乎是一个已知问题,但我找不到解决方案:

使用 KnpSnappyBundle 生成 jpg/pdf 时未加载 css 文件。 Here is a discussion 在 google 群组上,但没有提供答案。

有没有人找到解决这个问题的方法?

【问题讨论】:

    标签: symfony


    【解决方案1】:

    回答有点晚了,但我遇到了同样的问题,我使用绝对路径为我的资产解决了这个问题,如下所示:

    <link rel="stylesheet" href="{{ app.request.scheme ~'://' ~ app.request.httpHost ~ asset('bundles/factura/css/all.css') }}">
    

    希望对你有帮助

    【讨论】:

      【解决方案2】:

      github 上有一个“解决方法”,但它仍在合并请求中: 目前我认为这是最好的解决方案

      $this->get('knp_snappy.pdf')->getOutput()
      

      而不是

      $this->get('knp_snappy.pdf')->getOutputFromHtml()
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-06-07
        • 2014-05-10
        • 2021-04-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-10-09
        • 1970-01-01
        相关资源
        最近更新 更多