php - How can create multiple pdf files using mpdf API -
how can create multiple pdf files using mpdf api.
when try create using mpdf got error message
fatal error: cannot redeclare class mpdf
$sql1=mysql_query("select * $tbl_name"); while($row=mysql_fetch_array($sql1)) { $alert_date=$row['alert_mail_date']; $cart_body='<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>new order placed</title> </head> <body> <table width="550" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="400" align="left" valign="top"> <a style="font-size:16px"><strong>.$alert_date.</strong></a><br /> </body> </html>'; include("apis/mpdf/mpdf.php"); // define new mpdf document using utf-8 fonts $mpdf=new mpdf('utf-8'); $ran= rand(0,9999999); //$mpdf = new mpdf('ta',array(210,297)); //array(210,297) --> a4 size.. $mpdf->setautofont(autofont_all,array(210,297)); $mpdf->writehtml($cart_body); $filename="/opt/lampp/htdocs/invoice/invoice_pdf/".$ran."test.pdf"; $mpdf->output($filename,'f'); //$mpdf->output(); }
the error means have class of same name declared more once. maybe via multiple includes. use include
statement before loop.
also check out include_once. save next time.
Comments
Post a Comment