2017-07-22 9 views
2

我使用TCPDF库中笨生成PDF。我已经在Codeigniter3中成功集成了TCPDF 6.2.8版库。一切工作正常,但有几个通知。我尝试了很多,但无法捕捉确切的问题。TCPDF:严重性:通知 - >未定义偏移量:在 'TCPDF/tcpdf.php' 0在线路20373

我笨模型的方法是:

public function saveToPdf($html, $pdfName, $QRCodeData) { 
     $this->load->library('Pdf'); 
     $pdf = new Pdf(); 
     $pdf->SetAutoPageBreak(TRUE, 10); //set bottom margin 
     $pdf->AddPage(); 
     if ($QRCodeData): 
      $pdf->write2DBarcode($QRCodeData, 'QRCODE,H', 180, 13, 75, 75); 
     endif; 

     $pdf->lastPage(); 
     $pdf->writeHTML($html); 

     return $pdf->Output(APPPATH . "cache" . "/" . $pdfName, 'F'); 
    } 

一切工作正常,但此代码生成在很多地方偏移未定义通知。

我的错误日志:

ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: 0 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 20373 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: 0 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 18853 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: -1 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 20227 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: 0 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 20373 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: 0 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 18853 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: -1 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 20227 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: 0 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 20373 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: 0 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 18853 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: -1 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 20227 
ERROR - 2017-07-22 15:16:12 --> Severity: Notice --> Undefined offset: 0 /var/www/html/ts-2016/api/application/libraries/tcpdf/tcpdf.php 20373 

你可以看到我在github.com tcpdf.php在https://raw.githubusercontent.com/vsjadeja/tcpdf-codeigniter/master/application/libraries/tcpdf/tcpdf.php

请帮助我。

+0

后'Pdf'库代码。 – jagad89

+0

如果您打开文本编辑器中的通知中提到的文件,并检查相应的行号,您可能会知道发生了什么。它也将有助于获得堆栈跟踪,以便您知道自定义代码中的哪一行正在调用有问题的代码(不知道如何在CodeIgniter中执行此操作)。无论如何,我的教育猜测是'$ html'包含HTML,它不是支持的,甚至是错误的。 –

+0

@ jagad89库代码在给定的GitHub url上可用。 –

回答

1

TCPDF只支持少数的HTML标签,如果你已经添加了不支持晒黑你也将得到这个严重错误的另一个标签。

请找到支持标签的列表。

+--------------+-------+----------+-------------+ 
| <marker>  | <h1> | <ol>  | <i>   | 
+--------------+-------+----------+-------------+ 
| <a>   | <h2> | <option> | <img>  | 
+--------------+-------+----------+-------------+ 
| <b>   | <h3> | <p>  | <input>  | 
+--------------+-------+----------+-------------+ 
| <blockquote> | <h4> | <pre> | <label>  | 
+--------------+-------+----------+-------------+ 
| <body>  | <h5> | <s>  |    | 
+--------------+-------+----------+-------------+ 
| <br>   | <h6> | <select> | <table>  | 
+--------------+-------+----------+-------------+ 
| <br/>  | <hr> | <small> | <thead>  | 
+--------------+-------+----------+-------------+ 
| <dd>   | <hr/> | <span> | <tablehead> | 
+--------------+-------+----------+-------------+ 
| <del>  |  | <strike> | <th>  | 
+--------------+-------+----------+-------------+ 
| <div>  |  | <strong> | <td>  | 
+--------------+-------+----------+-------------+ 
| <dl>   |  | <sub> | <tr>  | 
+--------------+-------+----------+-------------+ 
| <dt>   |  | <sup> |    | 
+--------------+-------+----------+-------------+ 
| <em>   |  |   |    | 
+--------------+-------+----------+-------------+ 
| <font>  |  |   |    | 
+--------------+-------+----------+-------------+ 
| <form>  |  |   |    | 
+--------------+-------+----------+-------------+ 

我希望这会帮助你。

+0

不是这种情况... – Jakuje