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