1

私は自分の Moodle プロジェクトで DOMPdf を使用しています。この中で、html を pdf として作成しようとしています。私のローカル マシン (Mac システム) で完全に動作しています。Windows マシンと CentOS サーバーに同じコードを入れました。そしてそれは機能していません。数時間試していますが、解決策が得られません。すべての環境で PHP 5 を使用しています。

私が試した解決策:

  1. DOMPDF フォルダーに完全なアクセス許可 (777) を付与します。

以下は私のコードです

require_once("dompdf/dompdf_config.inc.php");

$Test='<html>
        <head>

        <title>Insert title here</title>
        </head>
        <body>    
         Sample Text
        </body>
        </html>';
    $dompdf = new DOMPDF();
    $dompdf->load_html($Test);
    $dompdf->render();
    $dompdf->stream("test.pdf");
echo $dompdf;

何が間違っているのかわかりません。どんな助けでも大歓迎です。

4

1 に答える 1

0

私はこの答えがみんなを助けると思う.......

<?php
 require_once("C:/dompdf/dompdf_config.inc.php");

$Test='<html>
    <head>
    <title>Insert title here</title>
    </head>
    <body>    
     Sample Text
    </body>
    </html>';
$dompdf = new DOMPDF();
$dompdf->load_html($Test);
$dompdf->render();
$dompdf->stream("test.pdf");
//echo $dompdf;
?>
于 2012-10-18T10:01:22.193 に答える