dompdf无法在cakephp中加载文档

时间:2016-04-24 13:09:55

标签: cakephp dompdf

这是我在book_pdf.ctp

中的代码
<?php
    require_once(ROOT . DS . 'Vendor' . DS . 'dompdf/dompdf' . DS . 'autoload.inc.php'); 
    use Dompdf\Dompdf;

    // instantiate and use the dompdf class
    $dompdf = new Dompdf();

    $dompdf->loadHtml('hello world');

    // (Optional) Setup the paper size and orientation
    $dompdf->setPaper('A4', 'landscape');

    // Render the HTML as PDF
    $dompdf->render();

    // Output the generated PDF to Browser
    $dompdf->stream();

    ?>

每当我下载文档时,它说无法加载它。

这与cakephp有关吗

1 个答案:

答案 0 :(得分:0)

此插件非常适合在cakephp上生成pdf

https://github.com/DaoAndCo/cakephp-dompdf