Ok great, this works perfect... The 'Class.getResource(String name)' gives the url with only "file:/" so i needed to replace that with "file:///" After that the logo appeared just fine...
Thx alot thomas.deweese wrote: > > Hi Vicent, > > "vincent.rigouts" <[EMAIL PROTECTED]> wrote on 05/02/2007 09:08:48 > AM: > >> I have an svg-template file with placeholders. My java code will replace > the >> placeholders with actual data and print the svg file to a printer. I > want to >> print a logo in the svg file that depends on the company, so the image > xlink >> uri will also be a placeholder that i fill in the java code by an image > that >> is contained inside the same jar file as the svg file and the java >> classes... >> >> This is how my image tag looks like in the svg file (#!IMAGE_LINK!# > being >> the placeholder): >> <image xlink:href="#!IMAGE_LINK!#" width="175" height="80.030212" >> id="image11007" x="524.96045" y="912.85516" /> >> >> My java code returns the following uri: >> jar:file:/C:/RepCache/$jars/myJar.jar!/be/company/pos/resource/logo.png > > First is this really a valid reference? do you really have a > directory 'C:/RepCache/$jars'? That doesn't look like a real > directory reference to me. Also do you think your Java app > has permission to read that jar file? If it's an applet or > JavaWebStart app it might not. > > Also I think you need 3 (yes 3) forward slashes '/' after the "file:": > jar:file:///C:/.... > > The best way to get URL's like this is to let the Java platform > build them for you. So you can use 'Class.getResource(String name)' > to find files like this, and then use 'toString' on the URL to get > what you want to pass to Batik. > >> So together this gives: >> <image >> xlink:href="jar:file:/C:/RepCache/$jars/myJar.jar! >> /be/company/pos/resource/logo.png" >> width="175" height="80.030212" id="image11007" x="524.96045" > y="912.85516" >> /> >> >> But when i print the document i only get a "broken image" file, so that > the >> path is invalid... >> >> I have tried many different ways, but i cant seem to get the image out > of >> the jar and print it... Someone got any idea's about this ? >> >> Thx alot, >> Vincent >> -- >> View this message in context: http://www.nabble.com/image-xlink-uri- >> refering-to-image-in-jar-file-tf3680432.html#a10285468 >> Sent from the Batik - Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/image-xlink-uri-refering-to-image-in-jar-file-tf3680432.html#a10302737 Sent from the Batik - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
