Support

Home Forums Event Espresso Premium Invoice PDF download does not work

Invoice PDF download does not work

Posted: July 16, 2019 at 7:10 am


TMG-Camp

July 16, 2019 at 7:10 am

When i or a customer try’s to download the PDF invoice the site redirect to the home page, and the PDF will not download/generated. Last versions WP and EE 4 plugins.
Could you please help, thankyou.


Josh

  • Support Staff

July 16, 2019 at 7:21 am

Hi,

May I ask does the Invoice render in html when you initially click the link (just doesn’t convert to PDF?)


TMG-Camp

July 16, 2019 at 7:34 am

Hi,
no it goes to the home screen without color and formatting.


TMG-Camp

July 16, 2019 at 7:43 am

i think i missunderstood. It shows the invoice in html but the “download PDF” button does not convert or download or do anything.


Josh

  • Support Staff

July 16, 2019 at 8:00 am

You could contact your host to see if they have a mod security rule that gets tripped when you try to download the PDF.

If there’s no mod security then it may help to check the html in the invoice to see if there’s any invalid html. Sometimes if there’s invalid HTML in the invoice, then the dompdf converter cannot render the PDF. May I ask is there an event on the site that I could register for as a test so I can check the invoice?


TMG-Camp

July 16, 2019 at 8:09 am

This reply has been marked as private.


Josh

  • Support Staff

July 16, 2019 at 9:56 am

Hi,

I checked the html within the invoice and there is some invalid html there and that invalid html would cause the PDF converter to fail. What you can do is go to Event Espresso > Messages > Default Message Templates then click to edit the Invoice and switch to Text view. What you’ll look for are closing paragraph tags, </p>, those need to be removed. I’ll follow up with a second, private, reply with a screenshot that shows where each of the errant tags are present.


Josh

  • Support Staff

July 16, 2019 at 9:57 am

This reply has been marked as private.


TMG-Camp

July 16, 2019 at 10:19 am

thanks a lot. but there is no </p>. i did not change anything in this Template, it is the standard configuration.

<div class=”print_button_div noPrint”>
[INVOICE_RECEIPT_SWITCHER_BUTTON] [DISPLAY_PDF_BUTTON]
<div class=”clear”></div>
</div>
<div id=”invoice”>
<table id=”invoice-header” class=”not-really-a-table”>
<tr>
<td id=”logo-dv”>
[INVOICE_LOGO]
<div class=”vcard” id=”company-address”>
<div class=”fn org”>[INVOICE_PAYEE_NAME]</div>
<div class=”adr”>
[INVOICE_PAYEE_ADDRESS]
</div>
<div class=”email”>[INVOICE_PAYEE_EMAIL]</div>
<div class=”vat”>[INVOICE_PAYEE_TAX_NUMBER_*]</div>
</div>
</td>
<td>
<div id=”invoice-info”>
<h2 id=”invoice-hdr”>Rechnung</h2>
<h3>
Datum: <span>[PRIMARY_REGISTRANT_REGISTRATION_DATE]</span>
</h3>
<h3>Registrierungscode: <span>[PRIMARY_REGISTRANT_REGISTRATION_CODE]</span></h3>

<h3>Transaktions-ID: <span>[TXN_ID]</span></h3>
</div>
</td>
</tr>
<tr>
<td id=”instructions” colspan=”2″>
[INVOICE_PAYMENT_INSTRUCTIONS]
</td>
</tr>
</table>

<h2>Rechnungsadresse:</h2>
<div class=”vcard” id=”client-details”>
<div class=”fn”>[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]</div>
<div class=”adr”>
<div class=”street-address”>
[PRIMARY_REGISTRANT_ADDRESS] <br>
[PRIMARY_REGISTRANT_ADDRESS2]
</div>
<div class=”locality”>[PRIMARY_REGISTRANT_CITY], [PRIMARY_REGISTRANT_ADDRESS_STATE]</div>
<div id=”client-postcode”>[PRIMARY_REGISTRANT_COUNTRY]</div>
</div>
</div>

<h2>Bestellungen</h2>
<table class=”invoice-amount”>
<thead>
<tr class=”header_row”>
<th class=”left ticket_th”>Artikel</th>
<th class=”left event_th”>Beschreibung</th>
<th class=”quantity_th”>Anzahl</th>
<th class=”left event_th”>Preis</th>
<th class=”subtotal_th item_r”>Summe</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan=”5″>[TICKET_LIST]</td>
</tr>
<tr class=”total_tr odd”>
<td colspan=”2″> </td>
<td colspan=”2″ class=”total” id=”total_currency”>Zwischensumme</td>
<td class=”total”>[TXN_SUBTOTAL]</td>
</tr>
<tr>
<td colspan=”5″>[ADDITIONAL_LINE_ITEM_LIST][TAX_LINE_ITEM_LIST]</td>
</tr>

<tr class=”total_tr odd”>
<td colspan=”2″> </td>
<td colspan=”2″ class=”total” id=”total_currency”>Summe</td>
<td class=”total”>[TOTAL_COST]</td>
</tr>
</tbody>
</table>

* steuerpflichtige Positionen

<h2>Zahlungen</h2>
<table class=”invoice-amount”>
<thead>
<tr class=”header_row”>
<th><span class=””>Zahlungsmethode</span></th>
<th class=’left datetime_th’>Datum</th>
<th><span class=””>Transaktions-ID / Scheck #</span></th>
<th><span class=””>Bestellung/Auftrag#</span></th>
<th><span class=””>Status</span></th>
<th>Betrag</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan=”6″>[PAYMENT_LIST_*]</td>
</tr>
</tbody>
<tfoot>
<tr class=’total_tr’>
<td colspan=”4″></td>
<td class=”item_r”>Insgesamt gezahlt</td>
<td class=”item_r”>[TOTAL_AMOUNT_PAID]</td>
</tr>
<tr class=”total_tr”>
<td colspan=”4″></td>
<td class=”total” id=”total_currency”>Offener Betrag</td>
<td class=”total”>[TOTAL_OWING]</td>
</tr>
</tfoot>
</table>
</div>
<div class=”print_button_div noPrint”>
[INVOICE_RECEIPT_SWITCHER_BUTTON] [DISPLAY_PDF_BUTTON]
<div class=”clear”></div>
</div>


Josh

  • Support Staff

July 16, 2019 at 10:34 am

You could check to see if another plugin or a theme function is adding those whenever there is a line break. If you deactivate all other plugins and switch to the default theme does the invoice convert to PDF as expected?


Tony

  • Support Staff

July 16, 2019 at 10:36 am

Your invoice template was setup using Event Espresso decaf, so your image URL’s are incorrect (note the broken image next to “Name der Veranstaltung” as an example). You can edit the template manually and change all references to /event-espresso-decaf/ to /event-espresso-core-reg/, or if you haven’t modified it at all then on the above template, click the ‘Reset Templates’ button in the sidebar.

That will regenerate the Invoice template based on the current directory in use by EE.

Next, go to Event Espresso -> Messages -> Settings -> PDF.

First, make sure it’s enabled and that the Invoice (and Receipt) message types are not in the ‘Inactive message types’ section.

If they are not, then drag the Invoice message type from Active to Inactive, wait a few seconds and drag it back.

That basically confirms that the settings are in sync with EE.

Now retest the PDF button, does it work?

Have you checked in your servers error logs to confirm if there’s an error being thrown when EE tries to generate the PDF?


TMG-Camp

July 17, 2019 at 2:42 am

thank you for reply, i did it all, i have deactivated all plugins, reset the Template and test it again, same result. but i found the issue. i deleted the logo [INVOICE_LOGO] from the invoice and it worked, then i can download the pdf. so the issue must be in this case in this code, but were can i fix it? after reset the invoice to default, the logo is in the code again and the issue, too. under settings i can only upload a image.


Tony

  • Support Staff

July 17, 2019 at 2:55 am

Enable WP_Debug using this code:

https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug

In your wp-config.php file and let me know when you’ve added it.

Note, you’ll have something like define( 'WP_DEBUG', false ); already in that file. The code from the link above should replace that single line.


TMG-Camp

July 17, 2019 at 3:33 am

ok, now its done.


Tony

  • Support Staff

July 17, 2019 at 3:37 am

Hmmm, no errors logged.

If you check your servers error logs can you see anything there?


TMG-Camp

July 17, 2019 at 3:58 am

yes but there is nothing, too. i checked the sourcecode from the html invoice. there i found a </p> behind the [INVOICE_LOGO] this might be the issue.

under Event Espresso -> Messages -> Messages activity
i found this:
Message was not executed successfully.
Messenger and Message Type were valid and active, but the messenger send method failed.

May it help to give you access to the wordpress server?


Josh

  • Support Staff

July 17, 2019 at 7:03 am

Hi,

I think there may be some confusion about what the source code is and isn’t. This is the source code, and as you’ll note, there are no </p> tags after the INVOICE_LOGO shortcode:

https://github.com/eventespresso/event-espresso-core/blob/master/core/libraries/messages/defaults/default/html_invoice_content.template.php#L14
Do you see the stray </p> tags in your site’s template editor in Event Espresso > Messages > Default Message Templates > Edit Invoice? If so, what you can do is remove those there, then click the save button.


TMG-Camp

July 17, 2019 at 7:15 am

i mean html, the same place you send me the screenshot on https://slack-files…. :

src="http://wordpress.de/wp-content/uploads/2019/07/Logo.png" width="69" alt="logo" /></p>

here i can see the </p>

in Event Espresso i cant see any </p>


Josh

  • Support Staff

July 17, 2019 at 7:19 am

Correct, so something is adding those p tags and what ever that something is it needs to stop doing that.

Have you checked to see if another plugin or a theme function is adding those whenever there is a line break? If you deactivate all other plugins and switch to the default theme does the invoice convert to PDF as expected?


TMG-Camp

July 17, 2019 at 7:33 am

see my answer before. i have deactivated all plugins, themes, reset the Template and test it again. same result.


Josh

  • Support Staff

July 17, 2019 at 7:40 am

You mentioned deactivating plugins, but did you temporarily switch to another theme? If what I suspect is happening, is happening, then something on your site is converting line breaks to closing paragraph tags. So a workaround would be to go into text mode of the editor and remove any line breaks where tags are added. For example, right after the [INVOICE_LOGO], you could move the next line’s contents up so it’s on the same line with [INVOICE_LOGO].


TMG-Camp

July 17, 2019 at 8:05 am

but when i delete only this [INVOICE_LOGO] in the editor then i can download the pdf, so this means the </p> comes with [INVOICE_LOGO] and not with breaks in the editor.

https://github.com/eventespresso/event-espresso-core/blob/master/core/libraries/messages/defaults/default/html_invoice_content.template.php#L14


TMG-Camp

July 17, 2019 at 8:19 am

and yes i switched to a default theme


Josh

  • Support Staff

July 17, 2019 at 8:46 am

Actually, no, the [INVOICE_LOGO] shortcode does not include a closing p tag. You can check the source code and see there’s no </p> returned:

https://github.com/eventespresso/event-espresso-core/blob/master/core/libraries/shortcodes/EE_Transaction_Shortcodes.lib.php#L506

Something else on your site is adding the stray closing p tags, it’s not coming from Event Espresso.


TMG-Camp

July 17, 2019 at 9:01 am

hmmmm….may it help to give you access to my wordpress server?


Tony

  • Support Staff

July 17, 2019 at 9:39 am

Not really, the shortcode works fine for everyone else, so this appears to be a config issue.

The one thing that sometimes causes issues with [INVOICE_LOGO] is the fact that it uses the getimagesize() function, which uses allow_url_fopen on the server. We don’t usually see the page directed to home like yours but it’s possible your host has some form of security enabled on the server that is throwing a false positive when the above is ran.

One thing you can try, is to enable WP_DEBUG site wide so that it displays all errors rather than logging them, that may give a hint to the issue.

To do that remove the code I gave you earlier from your wp-config.php file and replace that with: define( 'WP_DEBUG', true );

Then post here.


TMG-Camp

July 18, 2019 at 6:20 am

now i found the cause. the .png picture it self was the problem. when i use an other .png picture it works. only with this one not. maybe because it is one with transparent Background or something else is in this picture wich make it happend. thats why the shortcode works fine for everyone else.


Tony

  • Support Staff

July 18, 2019 at 7:54 am

I downloaded the PNG used on the Invoice which caused the failure and set it as the Invoice logo on one of my test sites. The PDF generated correctly on that site, so it is something on the server preventing the PDF from generating.

As there are no errors logged at all, we can’t say what it is but at a guess, it could be a missing PHP module or something your host is doing with the request for the image, hotlink protection maybe (that’s a bit of a log shot thought).

The support post ‘Invoice PDF download does not work’ 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.

Event Espresso