When a logo appears correctly in the WordPress Media Library but shows as an “X” inside a PDF generated by Gravity PDF, the problem may be image URL resolution rather than the image file itself.
In one WordPress project, a company logo needed to appear in the header of PDFs generated from forms. The logo could be uploaded normally and had a valid Media Library URL, but Gravity PDF did not render it correctly when that Media Library or CDN URL was used. A small production code snippet was added so Gravity PDF could resolve those media URLs properly during PDF generation.
Issue background
The site used Gravity PDF across multiple forms so submitted form data could be attached to outgoing emails as PDFs.
The request was to add a company logo to the PDF header. The logo itself had already been uploaded to the WordPress Media Library, but attempts to reference that image in the PDF resulted in a broken-image indicator rather than the expected logo.
This created a confusing situation because the image worked normally inside WordPress. The failure occurred specifically inside the PDF generation process.
Diagnosis
The developer traced the issue to the way Gravity PDF was resolving the image URL.
The logo was being referenced through a standard WordPress Media Library or CDN image URL. Although that URL was valid in the browser, Gravity PDF was not successfully accepting or resolving it during PDF generation.
That meant the problem was not the image upload itself and did not require replacing the logo with a different file format or abandoning the Media Library.
The key technical finding was that Gravity PDF needed additional handling so the Media Library/CDN URL could be translated into a usable image source while the PDF was being rendered.
Resolution steps
A practical troubleshooting workflow for a Gravity PDF logo that appears as a broken image is:
- Confirm the image is valid in WordPress. Open the logo from the Media Library and verify that the image URL loads normally in a browser.
- Test the image inside the PDF template. Use the standard Media Library URL and generate a PDF to confirm whether the problem occurs specifically during Gravity PDF rendering.
- Rule out a missing or inaccessible file. If the URL works in the browser but the PDF shows an “X,” the issue may be related to how Gravity PDF resolves the image rather than a missing asset.
- Account for CDN or Media Library URL handling. WordPress media may be served through a CDN or transformed URL. PDF rendering libraries may not always interpret those URLs the same way a browser does.
- Add an update-safe production snippet to resolve the media URL. In this case, a small code snippet was implemented so Gravity PDF could correctly resolve the WordPress Media Library/CDN image URL during generation.
- Keep using the standard WordPress image URL. After the fix, the logo could be selected and referenced using the normal image URL from the WordPress admin rather than requiring a separate local file path.
- Generate a fresh test PDF. Submit the form again and confirm that the logo appears correctly in the PDF header.
- Repeat the pattern for other forms if needed. Once the URL-resolution issue is fixed at the appropriate level, the same approach can be used for additional Gravity PDF templates that require branded header images.
The source task did not include the exact production snippet, so the important takeaway is the behavior being corrected: Media Library or CDN URLs that work in the browser may still need special resolution logic inside Gravity PDF.
Final outcome
After the production snippet was added, Gravity PDF was able to resolve the standard WordPress Media Library image URL correctly. The company logo could then appear normally in the PDF header instead of rendering as a broken image.
The broader lesson is that broken images in generated PDFs are not always caused by bad uploads. If an image works on the website but fails only inside Gravity PDF, inspect how the PDF generator is resolving the image source, especially when the site uses CDN-backed WordPress media URLs.
If Gravity PDF is showing broken logos, missing images, or other Media Library rendering problems on your WordPress site, contact Freshy. Our WordPress team can help troubleshoot Gravity PDF templates, media URL resolution, CDN image paths, and form-generated PDFs.