I have attached a background image, when I try exporting it to a PNG, the background is getting removed. I am using the makeImage() function of GoJS.
Also, the makeSvg() function is attaching the background image in the image tag, which when I am opening on another system, is not showing. I am not able to attach the sample SVG, but it is something like below.
But don’t you think that the background image should be combined with the elements on the top as that is why we are exporting it into a PNG/ SVG so as to access the flow diagram offline. Does GoJs have this functionality?
In that case you will need to customize the Diagram.makeSvg function by using its elementFinished option: Diagram | GoJS API
I think you’ll want your elementFinished function, when the element was for a Picture, modifies the resulting SVG element by inserting the contents of the SVG file.
Thank you @Walter for your quick reply. Can you please explain me with an example? I am attaching a jpg in the go.Picture, what should I set in the setAttribute?
Yes, I tried this earlier. We face one issue here, it only print the things which are visible on the screen to the user. Whatever is there below when we scroll up, it does not show.
You can use elementFinished of makeSVG in order to edit every SVG <image> element so that the href refers to a Base64 encoded string instead of a URL. I think this is what you want.