I was trying to store a JGoView in a file. I noticed that the Images that I used in the View were not stored (i mean, atleast the URL of the img files are not stored.) So when I open the same file, I’m not able to see the images… Is there any way to store the images also??Thanks in advance…
That’s odd–if you are generating SVG with the JGo XML extensions, for persistence, then the image file or URL information ought to be generated for each JGoImage object.
I suppose if you initialized the JGoImages by calling JGoImage.setImage instead of calling JGoImage.loadImage(String, boolean) or JGoImage.loadImage(URL, boolean), then there wouldn’t be any such file or URL information available. But then you would have the same problem just doing a copy and paste–the pasted JGoImage also wouldn’t have any Image because it wouldn’t know where to get the Image from.
I’ve tried both loadImage() and setImage()…Still the url of the images are not stored…
I tried with loadImage(Url)…its now coming…
How can I persisit the background image of the view??
Regarding the view’s background image–that has the same problem as JGoImages that don’t have a URL (or String filename) associated with them. On loading it wouldn’t know how to find the image source.
I suggest you use the same solution: use a JGoImage initialized by calling loadImage(URL, boolean). Create a new JGoLayer in the background of the document and add the JGoImage to that:
JGoLayer back = aDocument.createLayerBefore(null);
JGoImage img = new JGoImage();
You might want to set some other properties of the JGoImage, such as the bounding rectangle, depending on the image’s natural size.