You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
svgexport creates a pseudo-page on about:blank and then dumps the previously modified and grabbed SVG contents in there, in order to get a proper HTML with a screenshottable div. However, this means that (1) the new page is at an isolated location, and (2) the page is not loaded with the file:// protocol like local SVG files are usually.
This leads to two problems with SVGs that use the <image> tag to import other SVGs or images.
If the images use a relative import, that's broken. The images will just not show up.
If the images use a file:// protocol, even if the path is absolute, it also doesn't work. The images are replaced by a "file missing" icon and my guess is that the browser forbids the about:blank page to load stuff with the file:// protocol.
A fix would be to create an empty HTML file in the current location with a random name (and error out if it exists), then navigate to that. This would both allow the file:// URLs as well as relative imports. The file should of course be deleted before the program ends. I have had success with a workaround that changes render.js line 162 to use a local "sacrificial" HTML file.
To be clear: this is an issue with the way svgexport uses puppeteer, not an issue with puppeteer itself. All of this is expected Chromium behavior.
The text was updated successfully, but these errors were encountered:
I've come up against this issue too. Thank you for the suggested fix. I also got around it by using a "use" tag and an internal blob of image data. Definitely not ideal but it worked.
svgexport creates a pseudo-page on
about:blank
and then dumps the previously modified and grabbed SVG contents in there, in order to get a proper HTML with a screenshottable div. However, this means that (1) the new page is at an isolated location, and (2) the page is not loaded with thefile://
protocol like local SVG files are usually.This leads to two problems with SVGs that use the
<image>
tag to import other SVGs or images.file://
protocol, even if the path is absolute, it also doesn't work. The images are replaced by a "file missing" icon and my guess is that the browser forbids theabout:blank
page to load stuff with thefile://
protocol.A fix would be to create an empty HTML file in the current location with a random name (and error out if it exists), then navigate to that. This would both allow the
file://
URLs as well as relative imports. The file should of course be deleted before the program ends. I have had success with a workaround that changes render.js line 162 to use a local "sacrificial" HTML file.To be clear: this is an issue with the way svgexport uses puppeteer, not an issue with puppeteer itself. All of this is expected Chromium behavior.
The text was updated successfully, but these errors were encountered: