exportToPNG & exportToPDF images broken

Hi, I have an issue where when I use exportToPNG and exportToPDF, some images that I have in the Gantt appear as broken images. Any idea what could cause that?

Thank you

Hello Karl,
The links to the images should be publicly available. Otherwise, the export module won’t be able to download them, so the images won’t be displayed.

Also, it can be that you have unsafe elements. If you include SVG and Canvas elements directly, they won’t be added to the exported file for security reasons.

Your image will be exported in the following cases:
• It is an img element with the src element that points to the URL of the image.
• The image is added via the style rules. The URL in the background and background-image attributes can have the URL of the image or an image in the base64 format.
In both cases, it works for PNG, JPG, SVG elements.

It won’t work, in the following cases:
svg HTML element.
canvas HTML element.
• base64 format inside the src attribute for the img elements.

In the future, this information will be added to the documentation.

You can check how it works in the following snippet:

If you have the standalone export module, you can modify the source code and allow exporting SVG and Canvas elements, but in that case, your server will be vulnerable to XSS attacks.