woocommerece myaccount中的mpdf

时间:2018-07-14 06:39:55

标签: php wordpress woocommerce mpdf

我在wordpress myaccount页面中使用mpdf生成pdf时遇到问题。我在主题 inc 文件夹中使用的相同代码,根据需要生成pdf。您能建议我我所缺少的吗?我用谷歌搜索,发现到处都使用了插件,但是我不想使用任何插件。 以下是我在 woocommerce / myaccount / user_invoice.php 中使用的代码。 提到我也在 woocommerece / myaccount / 目录中使用了mpdf库。

这是我的代码:

include("mpdf/mpdf.php");
$mpdf=new mPDF();

$html = "test data";
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;

这是我得到的错误:

Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/rebuild/wp-includes/class.wp-styles.php:280) in /opt/lampp/htdocs/rebuild/wp-content/themes/rebuild/woocommerce/myaccount/mpdf/mpdf.php on line 7447

Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/rebuild/wp-includes/class.wp-styles.php:280) in /opt/lampp/htdocs/rebuild/wp-content/themes/rebuild/woocommerce/myaccount/mpdf/mpdf.php on line 1736
mPDF error: Some data has already been output to browser, can't send PDF file

0 个答案:

没有答案