Hello there,
We have a problem that we are not sure what is the way to approach. I'll try to state the problem and then look for suggestions.
Problem
We are trying to inline all of our external SVG files which use
Idea #1
Use a javascript library to convert all images with SVG path to an inline version. The problem with this is that we really care about performance. We assume that if we do this, each time we call Prince, it would need to fetch the SVGs and replace the content in HTML. This sounds really expensive.
Idea #2
Use an
Idea #3
Do some pre-processing before passing it to PrinceXML. This is the easiest, but it sounds like a headache for our frontend engineers because they have no way of testing.
So ideally, we'd like to use idea #1, but we need a way to cache data in javascript so we don't fetch the same resource over and over. Any suggestion? Or are there in features coming soon that might resolve this? Ideally, we'd like to use something like a localStorage where we can pass path to in CLI so that it can be used like any other browsers.
We have a problem that we are not sure what is the way to approach. I'll try to state the problem and then look for suggestions.
Problem
We are trying to inline all of our external SVG files which use
<img src="path/file.svg"/>
to an inlined <svg/>
content. We want to do this because we want to be able to style the SVG content. Idea #1
Use a javascript library to convert all images with SVG path to an inline version. The problem with this is that we really care about performance. We assume that if we do this, each time we call Prince, it would need to fetch the SVGs and replace the content in HTML. This sounds really expensive.
Idea #2
Use an
<object />
tag. This works, however, according to various sources, the style for the SVG needs to be included in the SVG. Not ideal since we don't know the final colors until generation. We have some custom colors, per our needs from a UI, so we don't really know the final HTML until generation. Idea #3
Do some pre-processing before passing it to PrinceXML. This is the easiest, but it sounds like a headache for our frontend engineers because they have no way of testing.
So ideally, we'd like to use idea #1, but we need a way to cache data in javascript so we don't fetch the same resource over and over. Any suggestion? Or are there in features coming soon that might resolve this? Ideally, we'd like to use something like a localStorage where we can pass path to in CLI so that it can be used like any other browsers.