I am facing problems in generating pdf using mpdf in wordpress myaccount page. Same code i used in themes inc folder which generates pdf as my need. Would you please suggest me what i am missing? I googled and found everywhere is used plugin but i don't wanna use any plugin. below is the code what i used in woocommerce/myaccount/user_invoice.php. Mentioning that i also used mpdf library inside woocommerece/myaccount/ directory.
Here is my code:
include("mpdf/mpdf.php");
$mpdf=new mPDF();
$html = "test data";
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
Here is the error what i got:
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