-
Notifications
You must be signed in to change notification settings - Fork 358
SVG to PNG not render images in Safari browser #223
Comments
I am also able to reproduce this issue, both in my own codebase and the example from @saulacher above. Safari: 12.1.1 (14607.2.6.1.1) It almost always happens on the first download. Successive downloads often yield the full svg as expected, but not always. |
I experience the same problem but with tspan in text |
Looking into this more, I see that Safari makes a new request for all linked assets. Here's a screenshot of the example shared by @saulacher (with the downloaded result showing in the upper right corner). Before clicking the "Save" button, I cleared all network requests from the log. As you can see, the 3 jpgs are requested again. My sense is that these resources are not yet downloaded when the png is created and therefore, do not show in the result. But when I click the "Save" button a second time, the 3 jpgs are not requested again and the png shows as expected. This aligns with my own case. The parts that don't show initially are When I switch out the webfonts for a system font ( Not yet sure what the solution is, but wanted to post my progress in the hopes it helps move this closer to a solution. |
Update: Looks like Chrome also makes requests, but some are pulled from cache. Still confused... |
I've narrowed it down to this line. From what I can find elsewhere, Safari has issues rendering linked assets when the canvas element is first drawn. In the source, just after the line I linked to, if you run While it's not ideal, I've found a workaround. To force the PNG to be generated twice, but dowloaded only once, I first running |
It looks like it might be a bug in WebKit. You can file an issue here. |
Hi, i have a problem with downloading svg as png in Safari. In Chrome works fine but in Safari sometimes (not every time) images in svg not rendering in final png.
https://jsfiddle.net/fvkjyLw4/
correct png (Chrome)
wrong png (Safari)
The text was updated successfully, but these errors were encountered: