Support

Home Forums Event Espresso Premium PDF not generated | Invalid argument in …/font_metrics.cls.php line 168

PDF not generated | Invalid argument in …/font_metrics.cls.php line 168

Posted: March 21, 2017 at 6:57 am


bmachuel

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.


Tony

  • Support Staff

March 21, 2017 at 7:35 am

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.


bmachuel

March 21, 2017 at 7:49 am

PDFs have worked until now.
Earlier today I tried to address fonts not displaying as expected on the PDFs (they are all replaced with Times New Roman). I added fonts to the desired file but that did not change anything. I removed the additional fonts then the PDFs generation stopped working. I uploaded a fresh dompdf folder (copied from the espresso plugin backup) but still no result.


bmachuel

March 21, 2017 at 7:51 am

Sorry: I am using EE4 latest version.


Tony

  • Support Staff

March 21, 2017 at 7:55 am

I uploaded a fresh dompdf folder (copied from the espresso plugin backup) but still no result.

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.


bmachuel

March 21, 2017 at 8:07 am

Actually, the entire EE plugin has been re-installed from the dashboard (not ftp) so there is no change left at all.


Tony

  • Support Staff

March 21, 2017 at 8:14 am

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?


bmachuel

March 21, 2017 at 8:29 am

No this is the only php error I see that involves EE.


Tony

  • Support Staff

March 22, 2017 at 6:04 am

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?


bmachuel

March 22, 2017 at 7:08 am

I have the following errors:
[22-Mar-2017 13:01:43 UTC] PHP Notice: Undefined index: serif in /home/fimcommu/public_html/fim-musicians/ioc/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/font_metrics.cls.php on line 168
[22-Mar-2017 13:01:43 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/fimcommu/public_html/fim-musicians/ioc/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/font_metrics.cls.php on line 168

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.


Tony

  • Support Staff

March 22, 2017 at 7:49 am

Have you edited the Invoice/Receipt templates to use a different font than the default?


bmachuel

March 22, 2017 at 7:54 am

Yes I am using Open Sans and Open Sans Condensed, which used to be converted by dompdf into Times Roman.


Tony

  • Support Staff

March 22, 2017 at 8:25 am

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.


bmachuel

March 22, 2017 at 8:28 am

I will try that, thanks.


Tony

  • Support Staff

March 22, 2017 at 8:30 am

I spoke about this further with @josh who recommend you try removing the !imporant declarations and added some fallbacks to the fonts, so for example try changing this:

<div id="invoice" style="font-family: 'Open Sans'!important">

to this:

<div id="invoice" style="font-family: 'Open Sans', Arial, sans-serif">

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.

Event Espresso