and this causes the errors. If I have htmlsc($item->item_description) it shows HTML tags in that field, for example ul and li tags instead of dots for an unordered list. Is there some way I can have this?
Today I noticed my quote template needed updating since I installed 1.5.9 recently. I altered my v1.5.9 pdf template file (as I noticed it was a bit different to my previous one after I just copied that version over) and it generated a couple of times fine, then after some edits of the quote and i tried to regenerate the PDF I got some PHP errors:
#### A PHP Error was encountered
Message: Undefined index: direction
Line Number: 13448
#### A PHP Error was encountered
Message: Cannot modify header information - headers already sent by (output started at /home/beardedd/public_html/ip159/vendor/codeigniter/framework/system/core/Exceptions.php:271)
Line Number: 564
#### An uncaught Exception was encountered
Message: Data has already been sent to output, unable to output PDF file
Line Number: 9292
I get a few more errors like this further down the page that loads.
A few pieces of information:
I am using PHP 7.1 on the invoiceplane directory.
I installed v1.5.9 as a clean install, not over the top of an older version, and have been using it for a month or so I’d guess.
I have not copied any old files over to the new 1.5.9 installation, I only just did that today to get some extra pdf quote templates.
Everything else in IP 1.5.9 seems to be working perfectly for me.
I get that there’s a problem with the MPdf.php file but I’d rather ask here first to see if anyone knows what I should do. I’m happy to update specific files etc.
My webhost says I am running close to using all of my inode quota, I have used 138076/150000 of it. I have about 2Gb of free disk space left on the account, so I guess its not space. Could the inode usage be a problem?
Sorry if the formatting of this message is no good, I coudln’t find a preview option before I posted
Thanks for the tips guys. If it was unclear, I edited my original message with an update and I found it was because I only removed a call to function htmlsc() in the PDF template.
I checked the mPDF supported HTML that Martin provided the link for and the HTML I am trying to include only uses ul, /ul, li and /li tags which are all supported by mPDF.
I’m not a PHP expert, but I think htmlsc() converts HTML special entities to their HTML codes so that, for example a greater than symbol, is displayed on the page instead of being considered as the start of a HTML tag. This is what I don’t want applied to the $item->description field. I want to be able to put HTML in the description and have it rendered on the PDF by mPDF. The previous version of IP would do this for me, so seems like the 1.5.x series is different in this aspect.
Today I went to generate another quote PDF and am getting errors again.
The default PDF template file works fine, but I want an altered version that hides the discount, item prices and item totals on my quotes.
So I decided to remove ALL of my altered code from my modified template and I am still getting mPDF errors. I have put the two files into an online diff checker, and I can’t see any reason why mPDF would fail up based on what I’ve done to the template file. I’ve literally brought it to the point that I have just some placeholder HTML comment tags in the file where I wanted my altered code and it’s STILL generating errors and failures.
The left is the default template, the right is my modified file with, now, only placeholder comment tags. There is still something wrong with this file and it generates error output as described above in the original post.
The only differences between the two files are:
Removed some th column headers
Removed the corresponding td column cells
Removed the footer
Some blank lines here and there.
Still getting errors. Starting to think this is not a template problem but if I select to use the default template it generates fine?
Ok, working from a new copy of the default template file, I did the following steps saving and testing as I went:
Moved Quote Notes from footer to above the itemized table - works fine
Moved Quote number heading to above the customer and company details - works fine
Removed table headers for item price, discount, item total - causes errors
running out of time now to keep testing but will take a good look at the table layout later to see if it is causing this.
Ok I have found that if you remove the TH tags and the TD tags you get all these errors. It must stuff up the formatting of the table if you do that, and I’d guess you could probably fix it by using some sort of colspan attribute in the HTML but for my needs it’s easier to just comment out the php calls that output the values and the header label names.