whoops i might have sent this email be4 prematurely.... rewriting just
to make sure.....

Hello all,
I have a function to save my svg document as a jpeg. i fixed my code
from be4 so unix or windows filepaths shouldnt make a difference. it
works fine in windows. but on unix, it saves a 0 kb jpg and throws an
exception somewhere as my code does not go completely through and get
the standard 'The page cannot be displayed' page.
I was wondering am i doing something screwy here?



 public static void saveJPEG(Document svgDoc, String fullPath,
PrintWriter out) {
        //printwriter used for debugging in servlet
        JPEGTranscoder t = new JPEGTranscoder();

        FileInputStream blah = null;
        TranscoderInput input = null;
        FileOutputStream ostream = null;
        TranscoderOutput output = null;
        
        File f = null;
        
        input = new TranscoderInput( svgDoc );
        
        f = new File(fullPath+     "yyyy.jpg");

        
        try {
            ostream = new FileOutputStream(f);
        } catch(FileNotFoundException e) {
            e.getMessage();
        }
        output = new TranscoderOutput(ostream);

        try {
>stack trace says there is a problem here....           
t.transcode(input, output);
        } catch( TranscoderException e) {
            e.getMessage();
        }
        
        try{
            ostream.flush();
            ostream.close();
        } catch(IOException e) {
            e.getMessage();
        }
        
        
    }


here is a stack trace on tomcat if anyone wants a look:

java.lang.NoClassDefFoundError
        java.lang.Class.forName0(Native Method)
        java.lang.Class.forName(Class.java:141)
        
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
        java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1041)
        org.apache.batik.ext.awt.image.GraphicsUtil.createGraphics(Unknown 
Source)
        org.apache.batik.gvt.filter.GraphicsNodeRed8Bit.genRect(Unknown Source)
        org.apache.batik.gvt.filter.GraphicsNodeRed8Bit.copyData(Unknown Source)
        org.apache.batik.ext.awt.image.rendered.TileCacheRed.genRect(Unknown 
Source)
        
org.apache.batik.ext.awt.image.rendered.AbstractTiledRed.drawBlockInPlace(Unknown
Source)
        
org.apache.batik.ext.awt.image.rendered.AbstractTiledRed.drawBlock(Unknown
Source)
        
org.apache.batik.ext.awt.image.rendered.AbstractTiledRed.copyToRasterByBlocks(Unknown
Source)
        
org.apache.batik.ext.awt.image.rendered.AbstractTiledRed.copyData(Unknown
Source)
        org.apache.batik.ext.awt.image.rendered.TranslateRed.copyData(Unknown 
Source)
        org.apache.batik.ext.awt.image.rendered.PadRed.copyData(Unknown Source)
        org.apache.batik.gvt.renderer.StaticRenderer.repaint(Unknown Source)
        org.apache.batik.gvt.renderer.StaticRenderer.repaint(Unknown Source)
        org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown 
Source)
        org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown 
Source)
        org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown 
Source)
        w6.saveJPEG(w6.java:254)
        w6.imageTest(w6.java:413)
        w6.doGet(w6.java:199)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to