微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – TCPDF在生成要打印的表结构时返回错误

我正在使用TCPDF在SmartJobBoard中工作. PDF是在旧服务器上正确生成的.

在我们将网站移动到新服务器后,它在创建PDF发票时开始显示错误. TCPDF库显示以下错误.

Notice: Undefined index: cols in /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP on line 22174
Notice: Undefined index: thead in /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP on line 21705
Notice: Undefined index: rows in /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP on line 22162
Warning: array_push() expects parameter 1 to be array, null given in /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP on line 22164
Warning: array_push() expects parameter 1 to be array, null given in /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP on line 22164
Warning: array_push() expects parameter 1 to be array, null given in /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP on line 22164
Notice: Undefined index: thead in /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP on line 21718

Exception Object
(
    [message:protected] => PDF generation Failed: Some data has already been output, can't send PDF file
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP
    [line:protected] => 29841
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/system/ext/tcpdf/tcpdf.PHP
                    [line] => 9062
                    [function] => Error
                    [class] => ExceptionThrowingTCPDF
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Some data has already been output, can't send PDF file
                        )

                )

            [1] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/system/lib/payment/Invoices/InvoiceManager.PHP
                    [line] => 141
                    [function] => Output
                    [class] => TCPDF
                    [type] => ->
                    [args] => Array
                        (
                            [0] => invoice_3284.pdf
                            [1] => D
                        )

                )

            [2] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/system/user-scripts/payment/view_invoice.PHP
                    [line] => 55
                    [function] => generatePDFVersion
                    [class] => SJB_InvoiceManager
                    [type] => ::
                    [args] => Array
                        (
                            [0] => 




Rechnung

Datum: 01.10.2014
Rechnung #3284
Status der Rechnung: In Bearbeitung (Zahlung auf Rechnung (Abonnement wird freigeschalten, sobald Zahlungseingang erfolgt ist.))

Rechnungsempfänger





Zahlungsempfänger

Ocean Harvest GmbH
Ruessenstrasse 18
6340 Baar

Konto:
Bank: UBS AG, Zug
IBAN: CH81 0027 3273 1186 8701 T


Beschreibung    Betrag
PlacementBooster.ch
Firmen-Abonnement: 12 Monate
50 Mitarbeiter (51 Accounts)    CHF 13,808.00
Zwischensumme   CHF 13,808.00
MWST-Nr. CHE-108.643.082 MWST MWST Ref.-Nr. 417985  CHF 1,104.64
Insgesamt   CHF 14,912.64

                            [1] => 3284
                        )

                )

            [3] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/system/core/ModuleManager.PHP
                    [line] => 127
                    [function] => execute
                    [class] => SJB_Payment_ViewInvoice
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [4] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/system/core/System.PHP
                    [line] => 140
                    [function] => executeFunction
                    [class] => SJB_ModuleManager
                    [type] => ->
                    [args] => Array
                        (
                            [0] => payment
                            [1] => view_invoice
                            [2] => 
                            [3] => /view-invoice/
                        )

                )

            [5] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/system/core/PageConstructor.PHP
                    [line] => 29
                    [function] => executeFunction
                    [class] => SJB_System
                    [type] => ::
                    [args] => Array
                        (
                            [0] => payment
                            [1] => view_invoice
                            [2] => 
                            [3] => /view-invoice/
                        )

                )

            [6] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/system/core/System.PHP
                    [line] => 193
                    [function] => getPage
                    [class] => SJB_PageConstructor
                    [type] => ::
                    [args] => Array
                        (
                            [0] => SJB_UserPageConfig Object
                                (
                                    [uri] => /view-invoice/
                                    [module] => payment
                                    [function] => view_invoice
                                    [template] => 
                                    [title] => View Invoice
                                    [parameters] => 
                                    [keywords] => 
                                    [page_exists] => 1
                                    [page_id] => 539
                                    [has_raw_output] => 
                                    [numberOfViews] => 
                                    [description] => 
                                )

                        )

                )

            [7] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/system/core/Request.PHP
                    [line] => 209
                    [function] => getPage
                    [class] => SJB_System
                    [type] => ::
                    [args] => Array
                        (
                            [0] => SJB_UserPageConfig Object
                                (
                                    [uri] => /view-invoice/
                                    [module] => payment
                                    [function] => view_invoice
                                    [template] => 
                                    [title] => View Invoice
                                    [parameters] => 
                                    [keywords] => 
                                    [page_exists] => 1
                                    [page_id] => 539
                                    [has_raw_output] => 
                                    [numberOfViews] => 
                                    [description] => 
                                )

                        )

                )

            [8] => Array
                (
                    [file] => /home/pb_admin/public_html/pb/index.PHP
                    [line] => 72
                    [function] => execute
                    [class] => SJB_Request
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

        )

    [prevIoUs:Exception:private] => 
)

为什么会发生这种错误

解决方法:

TCPDF需要100%有效的XHTML语法

即使是“HTML Tidy”也不会向您显示所有的HTML错误.在我的情况下,我有一个tr标签没有关闭,并在我纠正这个警告消失后,但pdf文件很难看.例如,通过colspan =“12”改变colspan = 12并且通过rowspan =“2”改变rowspan = 2来解决该问题.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐