我正在使用DOMPDF從HTML生成PDF。 我已經從github(編碼分支)複製了所有必需的文件。但它說類DOMPDF沒有錯誤,如下所示。在gitbubPHP致命錯誤:在第30行找不到類「DOMPDF」
鏈接dompdf_config.inc.php:https://github.com/dompdf/dompdf/tree/encoding
這裏是我的代碼:
require_once("APIs/dompdf-encoding/dompdf_config.inc.php");
$cart_body='<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>New Order Placed</title></head><body><p>Test Printing...</p></body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($cart_body);//body -> html content which needs to be converted as pdf..
$dompdf->render();
$dompdf->stream("sample.pdf"); //To popup pdf as download
實際產量:
Fatal error: Class 'DOMPDF' not found in /home/web/www/test_dompdf.php on line 30
線30 $dompdf = new DOMPDF();
備註:其他主分公司工作正常。我需要這個編碼分支,因爲它解決了與字體相關的編碼問題。
供應商文件夾在哪裏?我沒有看到任何東西 – logan
你需要安裝Composer並使用它。如果我將DOMPDF_ENABLE_AUTOLOAD設置爲False,那麼簡單看一下'http:// getcomposer.org/doc/00-intro.md' url,如上面的註釋DomPDF示例 –
那麼我不需要安裝自動加載? – logan