TCPDF错误;未定义的偏移量

时间:2017-05-09 20:59:16

标签: php html undefined offset tcpdf

我是php和html的新手。我目前正在开发一个功能正常的书店网站。管理员需要能够下载客户列表的pdf。我使用了tcpdf库但是在使用它时遇到了错误。该错误表示在使用writeHTML函数时,库的未定义偏移量。请注意,这是您按下创建pdf按钮后的代码。 line67 writeHTML()给出了一个错误 注意:未定义的偏移量:在第17161,1752,17981,17981,18279,17981,18288,18290,1752,17528行的C:\ wamp64 \ www \ pdf2 \ tcpdf \ tcpdf.php中为0 -

if(isset($_POST["create_pdf"]))
{
    require_once("tcpdf/tcpdf.php");
$obj_pdf = new TCPDF('P',PDF_UNIT,PDF_PAGE_FORMAT,true,"UTF-8",false);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetTitle("Customer List");
$obj_pdf->SetHeaderData("","", PDF_HEADER_TITLE, PDF_HEADER_STRING);
$obj_pdf->SetHeaderFont(Array(PDF_FONT_NAME_MAIN,"",PDF_FONT_SIZE_MAIN));
$obj_pdf->SetFooterFont(Array(PDF_FONT_NAME_DATA,"",PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT,'5',PDF_MARGIN_RIGHT);
$obj_pdf->SetPrintHeader(false);
$obj_pdf->SetPrintFooter(false);
$obj_pdf->SetAutoPageBreak(TRUE,10);
$obj_pdf->SetFont('helvetica',"",12);

$content="";
$content.='
    <h3 align="center"> Customer List </h3>
    <table border="1" cellspacing="0" cellpadding="5">
        <tr>
            <th width=5%>cus_id</th>
            <th width=10%>cus_f_name</th>
            <th width=10%>cus_surname</th>
            <th width=15%>cus_street_address</th>
            <th width=15%>cus_city</th>
            <th width=5%>cus_zip_code</th>
            <th width=10%>cus_country</th>
            <th width=15%>cus_phone_number</th>
            <th width=15%>cus_email</th>
        </tr>
';

$content .= fetch_data();

$content .= '</table>';

$obj_pdf->writeHTML($content);

$obj_pdf->Output("sample.pdf","I");

0 个答案:

没有答案