You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Arian Hojat <ar...@gmail.com> on 2005/05/02 12:39:32 UTC

saving a an svg as a jpeg on the server

Hello all,
i feel like such a newb posting and reposting here but my issues are
not completely solved yet and maybe someone can give a fresh outlook.
I have an svg in memory. i save it on windows fine. I fixed my code so
i dont need to know if i am on unix or windows. but anyway i

 public static void saveJPEG(Document svgDoc, String fullPath,
PrintWriter out) {


        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 {
            t.transcode(input, output);
        } catch( TranscoderException e) {
            e.getMessage();
        }
        
        try{
            ostream.flush();
            ostream.close();
        } catch(IOException e) {
            e.getMessage();
        }
        
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org