html2pdf适用于localhost但不适用于远程服务器

时间:2017-03-31 14:41:21

标签: php symfony html2pdf

我正在使用html2pdf库来生成PDF文件,奇怪的是我的功能在本地工作正常但是当我将它上传到远程服务器上时它不再起作用了!
我在我的symfony项目中使用这个库,我没有使用捆绑包我刚刚通过composer下载了库,然后直接在控制器中使用它:

public function pdfAction(){

        $view = $this->renderView('@BusinessPieces/piece/pdf.html.twig');

        $html2pdf = new \HTML2PDF();
        $html2pdf->writeHTML($view);


        return new Response($html2pdf->Output('example.pdf', 'I'), 200, array('Content-Type' => 'application/pdf'));
    }

这是我的观点pdf.html.twig:

<page orientation="portrait" format="A4" style="font-size: 18px">
    <h1>Exemple d'utilisation</h1>
    <br>
    Ceci est un <b>exemple d'utilisation</b>
    de <a href='http://html2pdf.fr/'>HTML2PDF</a>.<br>
</page>

这是我在localhost上得到的:
enter image description here 这就是我在远程服务器上得到的结果:
enter image description here

我做错了什么?

0 个答案:

没有答案
相关问题