Posted: March 21, 2017 at 6:57 am
Hi there, The invoice and receipt both display properly but when the “download pdf” is pressed, no PDF is produced and I get the following error message: Warning: Invalid argument supplied for foreach() in …/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/font_metrics.cls.php on line 168 Thanks in advance for your kind assistance. |
|
Hi there, Which version number of Event Espresso 4 are you using currently? Have the PDF’s previously worked? It looks like the fonts used by DOMPDF are missing or cant not be accessed on your server. |
|
PDFs have worked until now. |
|
Sorry: I am using EE4 latest version. |
|
Sounds like something is still missing, or if you previously used the plugin installer to install EE and used FTP to replace the above file the ownership could be wrong and may need changing. You’ll need to work through the changes you have made to find which one has caused the problem as its not an issue with EE, its an issue with the changes made. |
|
Actually, the entire EE plugin has been re-installed from the dashboard (not ftp) so there is no change left at all. |
|
Hmm, something must have change for it to now not work. Are there any more errors within the servers error log point to EE or DOMPDF? |
|
No this is the only php error I see that involves EE. |
|
Is the server currently set to display errors? If not can you enable that please, you may just need to enable WP_DEBUG but it depends on what you have setup. Then add a link here I can use to view the Invoice/Receipt please. Also have you tried disabling all non EE plugins and retesting? |
|
I have the following errors: Here is a link to one invoice/receipt. I cannot afford to deactivate plugins as the site is in production and international registrations may occur at any time. But I can create a staging version for debugging purposes. |
|
Have you edited the Invoice/Receipt templates to use a different font than the default? |
|
Yes I am using Open Sans and Open Sans Condensed, which used to be converted by dompdf into Times Roman. |
|
There’s something about the fonts that DOMPDF just does not like, at a guess I’d say the font its trying to use isn’t installed. The font working within the HTML output doesn’t mean it will work in DOMPDF as its processed in a completely different way. I’d create a new custom Invoice template and then reset it to default (using a NEW custom Invoice template means you can reset the template back to default without effecting the others however if you want to be really sure then do this on a development site) and confirm that the PDF’s work on the default template. You mentioned DOMPDF used to fall back to Time New Roman but your using !important within the Invoice styles, which means it shouldn’t (and likely is not) falling back to a different font. If the PDF generates correct using the default template you’ll need to work through your customizations to the template to find which one (if not many) cause the PDFs to fail. |
|
I will try that, thanks. |
|
I spoke about this further with @Josh who recommend you try removing the
to this:
Which may work within DOMPDF. |
|
The support post ‘PDF not generated | Invalid argument in …/font_metrics.cls.php line 168’ 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.