An uncaught Exception was encountered
Type: Mpdf\MpdfException
Message: must precede in a table
Filename: /home/press.altisinfonet.com/public_html/vendor/mpdf/mpdf/src/Mpdf.php
Line Number: 13410
Backtrace:
File: /home/press.altisinfonet.com/public_html/vendor/mpdf/mpdf/src/Mpdf.php
Line: 23545
Function: TableHeaderFooter
File: /home/press.altisinfonet.com/public_html/vendor/mpdf/mpdf/src/Tag/Table.php
Line: 1121
Function: _tableWrite
File: /home/press.altisinfonet.com/public_html/vendor/mpdf/mpdf/src/Tag.php
Line: 246
Function: close
File: /home/press.altisinfonet.com/public_html/vendor/mpdf/mpdf/src/Mpdf.php
Line: 15272
Function: CloseTag
File: /home/press.altisinfonet.com/public_html/app/libraries/Tec_mpdf.php
Line: 68
Function: WriteHTML
File: /home/press.altisinfonet.com/public_html/app/libraries/Sma.php
Line: 302
Function: generate
File: /home/press.altisinfonet.com/public_html/app/controllers/admin/Sales.php
Line: 418
Function: generate_pdf
File: /home/press.altisinfonet.com/public_html/index.php
Line: 303
Function: require_once
Asked
Active
Viewed 551 times
-1
-
1May be its a template issue !! check your table tbody thead tr td tfoot are closed correctly !! – Boominathan Elango Mar 12 '20 at 12:48
-
Next time when asking a question, an exception stack trace is certainly not enough, add a small code example reproducing the behaviour - see [MCVE](https://stackoverflow.com/help/minimal-reproducible-example). – Finwe Mar 14 '20 at 09:33
-
https://stackoverflow.com/q/18901950/2943403 – mickmackusa Jun 25 '20 at 03:39
1 Answers
1
In newer mPDF versions (or in a plaintext rendering), the message of this exception is <tfoot> must precede <tbody> in a table
.
By HTML 4 specification, the order of table elements has to be <thead>
→ <tfoot>
→ <tbody>
(this directly contradicts HTML 5 specification where the order is <thead>
→ <tbody>
→ <tfoot>
).
mPDF adheres to the HTML 4 in this matter.
Put yout <tbody>
to the end of the table and the exception will not be thrown.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot

Finwe
- 6,372
- 2
- 29
- 44