Hi, Thanks for the reply. I think Im almost there, but theres another error now that has replaced the old one. First of all you're suggested fix didnt quite work. The reason is because the in.setURI method only accepts a String by the looks of it. Is this right? I looked at the code and it appears to be true.. when I run your suggested fix I get: TestSVGGeneration.java:18: setURI(java.lang.String) in org.apache.batik.transcod er.TranscoderInput cannot be applied to (java.net.URL)
So I changed: in.setURI(f.toURL()); to: in.setURI(f.toString()); That seemed a bit better, but I get the following error now: java.io.IOException: unknown protocol: c at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source) at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown S ource) at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown S ource) at TestSVGGeneration.main(TestSVGGeneration.java:25) Exception in thread "main" org.apache.batik.transcoder.TranscoderException: null Enclosed Exception: unknown protocol: c at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown S ource) at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown S ource) at TestSVGGeneration.main(TestSVGGeneration.java:25) My code now looks like this: import org.apache.batik.transcoder.*; import org.apache.batik.transcoder.image.*; import org.apache.batik.*; import java.io.*; public class TestSVGGeneration{ public static void main(String args[]) throws Exception{ File f = new File("c:/temp/1.svg"); File fout = new File("c:/temp/test.png"); FileOutputStream osF = new FileOutputStream(fout); FileInputStream is = new FileInputStream(f); TranscoderInput in=new TranscoderInput(is); in.setURI(f.toString()); TranscoderOutput out = new TranscoderOutput(osF); out.setURI(fout.toString()); PNGTranscoder png=new PNGTranscoder(); png.transcode(in,out); } } I did hunt around for an answer, and I tried things like using file://c:/temp/1.svg but that didnt work either unfortunately. Any guidance you can supply is greatly appreciated. On Thu, 11 Nov 2004 06:02:00 -0500, Thomas DeWeese <[EMAIL PROTECTED]> wrote: > Rob wrote: > > > > Further to my previous email to the mailing list, I've now tried the > > following: > > [...] > > > That much nicer I think, but I still get an error unfortunately. The > > error now is: > > Exception in thread "main" org.apache.batik.transcoder.TranscoderException: > > null > > > > Enclosed Exception: > > null:-1 > > The URI "#linearGradient7024" > > specified on the element <linearGradient> is invalid > > This is probably due to the use of streams. With a stream it > doesn't know the 'base URL' for the document. I had thought that > we had worked this out for internal references but it appears there > is at least a few cases we missed. Anyway I think the fix is simple: > > File f = new File("c:\\temp\\1.svg"); > FileInputStream is = new FileInputStream(f); > TranscoderInput in = new TranscoderInput(is); > in.setURI(f.toURL()); > > --------------------------------------------------------------------- > 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]