Support

Home Forums Event Espresso Premium PDF encoding issue

PDF encoding issue

Posted: June 12, 2019 at 2:34 am


razemrozkodujmyafazje

June 12, 2019 at 2:34 am

Hello,
We have issue with downloaded PDF invoice. The PDF is not generated with proper characters with questions marks instead:
Example:
P?atno?ci

Could you please provide my a quick solution for that, as we are going live soon.


Tony

  • Support Staff

June 12, 2019 at 4:36 am

Hi there,

You’ll likely need the UTF8 template add-on which includes a font that can display non-latin characters. That add-on is available on the pre-release channel, which you can join by following the steps here:

https://eventespresso.com/wiki/pre-release-channel-guide/

The docs for the add-on can be found here:

https://eventespresso.com/wiki/ee4-utf-8-template-variation-add/

Essentially you download the add-on, activate it, then set the ‘Simple UTF8’ template on the Invoice/Receipts templates in:

Event Espresso -> Messages ->Default message Templates -> Receipt / Invoice


razemrozkodujmyafazje

June 12, 2019 at 4:39 am

Yes, I already did it, for I’ve found this solutions on the forum. I downloaded the add-on, installed and launched it. I changed the template to Simple UTF-8, but it did not help. The PDF still has bad encoding characters.


razemrozkodujmyafazje

June 12, 2019 at 4:43 am

Just to add. The invoice is show correctly on the screen but only the downloaded PDF file has encoding issue.


Tony

  • Support Staff

June 12, 2019 at 4:57 am

Can you link me to an Invoice for a test registration so I can take a look?

Just to add. The invoice is show correctly on the screen but only the downloaded PDF file has encoding issue.

That’s expected, its DOMPDF (which we use to generate the PDF’s) that is struggling with the characters, your browser will display them fine as it will have the font’s installed on your system.


razemrozkodujmyafazje

June 12, 2019 at 5:17 am

This reply has been marked as private.


Tony

  • Support Staff

June 12, 2019 at 7:45 am

It looks like we need to update the UTF8 add-on the pre-release channel to include the latest changes for DOMPDF included in core, I’ll get that updated soon.

In the meantime, you can use the version HERE.

De-activate and delete the current ‘EE4 UTF8 Template Variation’ add-on you have, then install and activate the above.

That should load the font correctly in the PDF.


razemrozkodujmyafazje

June 12, 2019 at 7:56 am

Dear Tony,
thank you for the quick response. I did as advised but unfortunately it did not help. 🙁


Tony

  • Support Staff

June 12, 2019 at 8:11 am

Ok, looking at your Invoice I can see its loading the utf8 files however the PDF has no styling applied at all.

That’s normally an indication that allow_url_fopen has been disabled on the server, meaning DOMPDF can’t pull in the ‘external’ files (CSS, images and so on are considered external in this case).

If you go to Event Espresso -> Maintenance -> System information

Search for ‘allow_url_fopen’ what does it show?


razemrozkodujmyafazje

June 12, 2019 at 8:16 am

It shows:

global_value 1
local_value 1
access 4


Tony

  • Support Staff

June 12, 2019 at 8:27 am

Ok, can you temporarily enable WP_Debug on the site so I can see if there are any errors?

To do that you add the snippet shown here:

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

To your wp-config.php file, somewhere above this line /* That's all, stop editing! Happy blogging. */


razemrozkodujmyafazje

June 12, 2019 at 8:31 am

Done.


Tony

  • Support Staff

June 12, 2019 at 8:45 am

Thank you, but no error captured in relation to the PDFs.

Try just using define( 'WP_DEBUG', true ); temporarily (fair warning any errors/notices etc will be shown to your visitors whilst that is enabled) and I’ll download PDF whilst errors are shown.

Or, you can use:

define( 'WP_DEBUG', true );
if ( WP_DEBUG ) {
        @ini_set( 'display_errors', 1 );
        define( 'WP_DEBUG_LOG', true );
        define( 'WP_DEBUG_DISPLAY', true );
}

Again, errors will be output to that page whilst this is enabled so set it and let me know, I’ll download a PDF and post here so you can disable again, or you can download the PDF and disable again, then send me the PDF if preferred.


razemrozkodujmyafazje

June 12, 2019 at 8:57 am

I turned on the debug. Please try now.


razemrozkodujmyafazje

June 12, 2019 at 8:58 am

What I can see is:

Warning: sprintf(): Too few arguments in /home/rafazje/domains/rozkodujmyafazje.pl/public_html/wp-content/plugins/event-espresso-core-reg/payment_methods/Invoice/EE_PMT_Invoice.pm.php on line 40


Tony

  • Support Staff

June 12, 2019 at 9:02 am

That’s an issue with a translation and is unlikely to cause this problem.

You can switch back to just logging errors now, nothing new output to the screen with the above so no help.

Ok, can you edit the Invoice template again and switch to just the ‘Simply’ template, not the UTF8 one, just the normal default style.


razemrozkodujmyafazje

June 12, 2019 at 9:08 am

I’ve switched back to Simple Template Style


razemrozkodujmyafazje

June 12, 2019 at 11:27 am

Would you be able to help me with the issue by Friday 06/14/2019?


Tony

  • Support Staff

June 13, 2019 at 3:24 am

I’ve switched back to Simple Template Style

Thank you, so I’ve used that to confirm you have the same issue on the standard template, so encoding issue aside there’s something on your server preventing the CSS files from being loaded into DOMPDF.

I tested the UTF8 add-on my site after switching the language to Polish and downloading a PDF: https://monosnap.com/file/IDsSAd90U6GmIXkQsJ6lY5ridcr7Zl

As you can see the non-latin characters are loading correctly there.

I ran a few more tests against the files on your site and as mentioned, it does appear that ‘external’ files are being blocked.

I ran this from one of my servers:

$test = file_get_contents('http://www.rozkodujmyafazje.pl/wp-content/plugins/event-espresso-core-reg/core/libraries/messages/defaults/default/variations/html_base_default.css');
var_dump($test);

Which returns: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden

I recommend you contact your host and have them investigate this further, something on your server is blocking the above connections (file_get_contents() is the function used by DOMPDF, so it needs to function).


razemrozkodujmyafazje

June 13, 2019 at 5:37 am

Thank you Tony for making the tests. I will try to contact our host provider and ask for switching on file_get_contents() on the server. However, if, due to security reasons, the host will not allow for that, is there any temporary solution I can apply on my WP local installation to get it work? Is there any workaround that you are aware of and would you be able to provide?
We are worrying we would not be able to open our ticket registration on time, due to this problem with PDFs.
Much appreciated, if you could help us.
Thank you


Tony

  • Support Staff

June 13, 2019 at 5:47 am

No, there’s no workaround for this.

DOMPDF will apparently try to use cURL if allow_url_fopen is disabled but we often have reports from users with allow_url_fopen that PDF’s aren’t working, they then enable allow_url_fopen and it works as expected so it appears the cURL method often doesn’t work.

You apparently already have allow_url_fopen enabled (which is what file_get_contents() uses) which is generally what hosts will state is a security risk.

If your host is not willing to enable the functions required you’ll need to change hosts.

The support post ‘PDF encoding issue’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 5 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!