Error generating document: Failed to generate PDF with DOMPDF

Created on 29 March 2017, about 7 years ago
Updated 4 January 2024, 6 months ago

I have installed Entity Print on Drupal core 8.2.6

The following is my configuration:

Enable Default CSS
Force Download
Default PDF engine for printing = Dompdf
Paper Size = Letter
Paper Orientation = Portrait
Enable HTML5 Parser
Enable Remote URLs

When clicking View print via the Entity Print block, the following error is displayed:

Error generating document: Failed to generate PDF: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known, file_get_contents(http://dev2.uspnf.com/sites/default/files/css/css_w6e_sNVvIjxEWdBNonpUitS4mheMH0BuAKcTwMQ-YG8.css?onlc1k): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known, Unable to load css file http://dev2.uspnf.com/sites/default/files/css/css_w6e_sNVvIjxEWdBNonpUitS4mheMH0BuAKcTwMQ-YG8.css?onlc1k

--------------------------
Potentional solution
This issue is not in the module scope. The reason is using file_get_contents() from pdf library. Dompdf library doesn't see your file cause your host may not be visible for the webserver. It often happens when you use Lando or any other kind of docker virtualization.

So put this code in your settings.php

for nginx:
$settings['file_public_base_url'] = 'http://nginx/sites/default/files';

for lando:
$settings['file_public_base_url'] = 'http://appserver_nginx/sites/default/files';

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States sassafrass

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024