GitHub user dosubot[bot] added a comment to the discussion: Image is blank 
during pdf export in Superset UI

<!-- Answer -->
Thanks for the details! Since you're using external image URLs in Markdown 
components and Handlebars charts, this is almost certainly a **CSP (Content 
Security Policy) issue**.

The key insight is that [PDF export uses the `connect-src` directive to fetch 
external images](https://github.com/apache/superset/issues/36268), not 
`img-src` (which is what the dashboard uses for normal viewing). This is why 
your images may display correctly on the dashboard but appear blank in the PDF.

**Solution:** Add your external image domain(s) to the `connect-src` directive 
in your [Talisman 
configuration](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py#L1644-L1674):

```python
TALISMAN_CONFIG = {
    "content_security_policy": {
        "connect-src": [
            "'self'",
            "https://your-image-domain.com";,  # Add your external image domain 
here
        ],
        "img-src": [
            "'self'",
            "data:",
            "blob:",
            "https://your-image-domain.com";,  # Also add here for dashboard 
viewing
        ],
    }
}
```

Replace `https://your-image-domain.com` with the actual domain(s) where your 
images are hosted. If you have multiple domains or need to allow all external 
images (less secure), you can use `*` as a wildcard.

After updating your `superset_config.py`, restart Superset for the changes to 
take effect. Let me know if this resolves the blank image issue!


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/41ff8fb0-443b-45a3-b288-efb01b904273?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/41ff8fb0-443b-45a3-b288-efb01b904273?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/41ff8fb0-443b-45a3-b288-efb01b904273?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/41ff8fb0-443b-45a3-b288-efb01b904273?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/41ff8fb0-443b-45a3-b288-efb01b904273?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/41ff8fb0-443b-45a3-b288-efb01b904273?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/41ff8fb0-443b-45a3-b288-efb01b904273?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Thanks%20for%20the%20details%21%20Since%20you%27re%20using%20external%20image%20URLs%20in%20Markdown%20components%20and%20Handlebars%20charts%2C%20this%20is%20almost%20certainly%20a%20%2A%2ACSP%20%28Content%20Security%20Policy%29%20issue%2A%2A.%0A%0AThe%20key%20insight%20is%20that%20%5BPDF%20export%20uses%20the%20%60connect-src%60%20directive%20to%20fetch%20external%20images%5D%28https%3A//github.com/apache/superset/issues/36268%29%2C%20not%20%60img-src%60%20%28which%20is%20what%20the%20dashboard%20uses%20for%20normal%20viewing%29.%20This%20is%20why%20your%20images%20may%20display%20correctly%20on%20the%20dashboard%20but%20appear%20blank%20in%20the%20PDF.%0A%0A%2A%2ASolution%3A%2A%2A%20Add%20your%20external%20image%20domain%28s%29%20to%20the%20%60conn
 
ect-src%60%20directive%20in%20your%20%5BTalisman%20configuration%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py%23L1644-L1674%29%3A%0A%0A%60%60%60python%0ATALISMAN_CONFIG%20%3D%20%7B%0A%20%20%20%20%22content_security_policy%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22connect-src%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%27self%27%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22https%3A//your-image-domain.com%22%2C%20%20%23%20Add%20your%20external%20image%20domain%20here%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%22img-src%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%27self%27%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22data%3A%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22blob%3A%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22https%3A//your-image-domain.com%22%2C%20%20%23%20Also%20add%20here%20for%20dashboard%20viewing%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%7D%0A%7D%0A%60%60%60
 
%0A%0AReplace%20%60https%3A//your-image-domain.com%60%20with%20the%20actual%20domain%28s%29%20where%20your%20images%20are%20hosted.%20If%20you%20have%20multiple%20domains%20or%20need%20to%20allow%20all%20external%20images%20%28less%20secure%29%2C%20you%20can%20use%20%60%2A%60%20as%20a%20wildcard.%0A%0AAfter%20updating%20your%20%60superset_config.py%60%2C%20restart%20Superset%20for%20the%20changes%20to%20take%20effect.%20Let%20me%20know%20if%20this%20resolves%20the%20blank%20image%20issue%21)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/38244)

GitHub link: 
https://github.com/apache/superset/discussions/38244#discussioncomment-15921053

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to