I'm using CakePHP 1.3 to make an online application system. I try to print a PDF document using TCPDF based on a view.
I use the code
$this->writeHTML($this->render('print') )
in my print controller.
The problem is that I have this
undefined index : cols
error output to the screen. What could have gone wrong?
I run into the same problem today (even though I am not using CakePHP), and all it took to fix this problem was to add a valid <thead>
element to every table that I was embedding. Apparently, TCPDF parses the <thead>
element to determine the number of columns in a table when it outputs tables in PDF.
Also, I would recommend to generally check if your HTML is valid if some other errors keep occurring.
I hope this helps.