Posted: November 22, 2017 at 8:55 am
|
Hello, I created a custom HTML template for invoice template..Everything works well until i click the generate pdf link. My web browser keeps loading until it displays an error 500. EE also writes up-to 8MB of data to WP debug.log On inspection of the generated error logs, i noticed the following lines recurring:
At this point, I’m lost, confused & frustrated. Please can you help me see what I’m doing wrong? Maybe my CSS is causing issues or my html is a bit off? Please help me look into this. Can you provide me with a secure way to share my website access credentials? Thank you. |
Hi George, I reviewed the html templates and I’m afraid there are parts of the html within the templates that will result in invalid html, and the DOMPDF scripts cannot always handle invalid html. The way forward will be to make copies of the original templates from Event Espresso and modify them to suit your needs. The following is a list of your templates that need to be fixed: html_invoice_additional_line_item_list.template.php Quite frankly I’m a bit puzzled over all the additional markup that was added to the above templates. If you switch over to the default template pack (and do a template reset) does the Invoice generate a PDF without the errors? |
|
|
Hi Josh, Thank you for your support. Yes, i did create a messaging template plugin (followed the docs instructions). Please can you point me in the right direction with regards which html tags are invalid so i may remove them, i don’t know which ones are invalid and the debug.log isn’t mentioning any tags. I’d really appreciate this. Thank you |
It’s not so much as issue where you have invalid tags so to speak. The issue seems to be you’ve added a lot of nested html that doesn’t seem even to be necessary. The way forward, or right direction if you will, will be to start with the default templates and add only what’s necessary. An example of something that’s not necessary is the multiple of additional html tables within tables. The HTML invoice isn’t an email, so need for all of those. Also, when adding additional markup please bear in mind that if you open a tag in a template that starts a section you will need to close that tag in the template that ends that section. |
|
Along with the above, if you have concern that your CSS is causing an issue, then it will help to know how that CSS is being included into the invoice and the contents of that CSS. |
|
|
Hello Josh, Thank you. With your support & guideance, i was able to recreate the templates from scratch and removed all uneccesary/redundant tags and which reduced each file by up to 80%. pdf downloads now works. However, im still receving this errors in debug:
And the created pdf file it almost 6 to 10 pages that are mostly blank. Please can you also help with this? Im suspecting its coming from my pdf css but im not sure what to do or look for in this case. Here’s a link to my debug.log Thanks! |
Where might I be able to download your pdf CSS and the script that loads that CSS so I can help you with that? |
|
|
Hello Josh, I have included the stripped version of my EE message plugin (just to include the html templates, CSS, plugin files – for your reference). Please follow this link:
I’m not sure i understand what scripts because in my template, i added this CSS directly in the html_main_wrapper.template.php file. Please take a look at my custom plugin to see this. Perhaps im doing something wrong. Thanks alot! |
May I ask why the stripped version? Please help us help you by including all of the code so we don’t have to guess about the other parts that you didn’t include. |
|
|
Hi Josh, I only removed the template files i don’t have an issue with and included only the HTML Invoice template so we dont mix things up thats all. Please follow this link for the complete custom message plugin. |
Can you run the generated html invoice through an html validator and check for errors? |
|
|
There were some HTML validation errors caused by tag formatting and obsulate tags & attributes. I have corrected them & updated zip file. Please use same link to download Thanks! |
Hi George, That helps, thanks. The reason for the blank pages in the PDF is because of this CSS from your custom html_main_default.css stylesheet, starting on line 56:
You can remove that CSS and you’ll see that the invoice will fill 1-2 pages at most. One thing to watch out for with DOMPDF generated PDFs is they do not support all of CSS 2.1 properties and very little of CSS 3’s properties. Here’s a link to the DOMPDF wiki that shows which properties are supported: The recommended way to customize the invoices is start with the defaults and tweak the html and CSS only where needed. You’ll find that if you do a complete overhaul of the markup and CSS it can be very difficult to get the DOMPDF generated invoice to match the html invoice displayed in the browser. |
|
|
Thanks alot Josh, The extra pages are all gone but i noticed the pages are shrinked (like the css is still not 100% ok) Any ideas as to what might be causing it? Im just lost |
The script that generates the PDF (DOMPDF) does not support all CSS 2.1 properties and very few of CSS3’s properties. Here’s a link to the DOMPDF wiki that shows which properties are supported: https://github.com/dompdf/dompdf/wiki/CSSCompatibility#properties |
|
The support post ‘HTML Invoice Message Template Error’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.