Common Image Display Errors in PDFs and How to Fix
Do you see a red cross showing in your PDFs where an image should be? Or is an image error displayed on-screen instead of your PDF? If so, this guide is for you.
I upgraded to Gravity PDF 6.13.0 and now some images aren't showing in PDFs. Why!?
In Gravity PDF v6.13.0 we switched from native cURL to WordPress' wp_safe_remote_get()
for all PDF HTTP requests (e.g. loading images and stylesheets). This offers improved security when dealing with external requests, better reliability across hosts, and affords developers more control over what and how assets are loaded. Improving security generally means restricting or changing existing functionality, and this may cause problems for some users.
How do I find out why images aren't displaying?
Any HTTP request made during PDF generation will get saved to a log file when logging is enabled:
- Enable Gravity Forms logging.
- Go to the Entry List page and view one of the broken PDFs. This will populate the log file with information about the PDF generation – including any HTTP errors.
- Inspect the Gravity PDF log file for lines with "Remote request error":
2025-07-23 10:09:39 (+10:00) - ERROR --> Remote request error for https://resources.gravitypdf.com/logo.png: "http_request_not_executed: User has blocked requests through HTTP."
Why are image errors displaying on-screen when I try view or download a PDF?
This is a debugging feature to make it faster for developers to diagnose and fix PDF errors. It's enabled when WP_DEBUG
is set to true
in the wp-config.php
file and WP_DEBUG_DISPLAY
isn't set to false
.
To hide the error you'll need to disable WordPress debug mode, or hide the debug messages by modifying values in your wp-config.php
file.
Disable debug mode entirely (recommended in production environments):
define( 'WP_DEBUG', false );
Or keep debug mode enabled, but hide errors and warnings on screen:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
Importantly, if your wp-config.php
file already has these lines don’t add additional copies of them. Replace/modify the existing lines.
Once this change is made your PDF will begin generating and a red cross will be shown wherever there's a problem loading an image. Learn more about debugging in WordPress.
Common Image Errors
This is a list of common image-related errors in PDFs and how to fix them.
HTTP error 404
The web server returned a 404 Image Not Found error. Verify the URL points to a valid image.
HTTP error 403
The web server returned a 403 Forbidden error. This is common when a web server has hotlink protection enabled. To fix this, upload the image to the WordPress Media Library and update your PDF to reference the new image.
User has blocked requests through HTTP
It's likely WP_HTTP_BLOCK_EXTERNAL
is set to true
in the wp-config.php
file. This constant prevents any remote requests that aren't a loopback request e.g. to your own website. It's common for WP_ACCESSIBLE_HOSTS
to be used alongside WP_HTTP_BLOCK_EXTERNAL
to allow an approved list of hosts, and block everything else. Alternatively, the pre_http_request
filter can be used to do more advanced blocking.
To work around this restriction you can either:
- Upload the image to your WordPress Media library and then update your PDF settings to use the locally-hosted image
- Update your approved list of hosts to include the domain where the image is located i.e. add the domain to
WP_ACCESSIBLE_HOSTS
in yourwp-config.php
file or update thepre_http_request
filter.
SSL certificate problem: unable to get local issuer certificate
If there's an SSL certificate problem the solution will depend on whether this is a production or development website.
Production
In a production site it's vital you don't circumvent or bypass any SSL certificate errors, as this creates a security issue and makes your website susceptible to man-in-the-middle attacks. If you own the domain, ensure the SSL certificate for that domain is issued by a trusted Certificate Authority, not expired, and configured correctly. If you don't own the domain, upload the image to the WordPress Media library and update your PDF settings.
Development
If this is a development website on your local network with a self-signed SSL certificate, you can use this snippet to bypass SSL verification when loading PDF images:
add_filter( 'gfpdf_remote_request_args', function( $args ) {
$args['sslverify'] = false;
return $args;
} );
Connection timed out after 5001 milliseconds
When loading images over HTTP there is a five-second request timeout. This error occurs if the image isn't downloaded in this timeframe.
You can either:
- Upload the image to your WordPress Media library and then update your PDF settings to use the locally-hosted image
- Increase the request timeout limit using this code snippet:
add_filter( 'gfpdf_remote_request_args', function( $args ) {
$args['timeout'] = 10; // increase to 10 seconds
return $args;
} );
Increasing the timeout means PDFs may take longer to generate, so option 1 is recommended.
A valid URL was not provided
Before a PDF HTTP request is made, the URL for the image is run through the wp_http_validate_url()
function and will do various checks to see if a URL may be unsafe. This includes checking the protocol (http/https), hostname, port, syntax errors, and more.
The fix will depend on what part of the URL was flagged. If the URL is malformed you may only need to remove an extra forward slash or fix a typo. If you're attempting to load an image using a non-standard method, the solution is less obvious. WordPress' HTTP API includes various filters to change how requests are handled. Which to use requires technical knowledge of your infrastructure and requirements and is outside the scope of this guide.
If you aren't sure how to proceed, the safest option is to upload the image to the WordPress Media Library and update your PDF to reference the new image.