Hello 

I am trying to convert a svg file to PDF using BATIK and FOP. I write
the following code ... It works fine for small svg files. But when i
open a relatively large SVG file and try to convert that into PDF it
gives me the following error

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError:
Java heap space

We can allocate more memory to Java Runtime but i dont think that
would be a good solution.

Can anybody please tell me how can i optimize the memory usage to
convert the svg to pdf. Is there anyother way around to do this ???

Shayer 

Code :
========================================================= 


public void svg2pdf(File svg, File pdf) throws IOException,
TranscoderException {
        
        //Create transcoder
        Transcoder transcoder = new PDFTranscoder();
        //Transcoder transcoder = new org.apache.fop.render.ps.PSTranscoder();
        
        //Setup input
        InputStream in = new java.io.FileInputStream(svg);
        try {
            TranscoderInput input = new TranscoderInput(in);
            
            //Setup output
            OutputStream out = new java.io.FileOutputStream(pdf);
            out = new java.io.BufferedOutputStream(out);
            try {
                TranscoderOutput output = new TranscoderOutput(out);
                
                //Do the transformation
                transcoder.transcode(input, output);
            } finally {
                out.close();
            }
        } finally {
            in.close();
        }
    }

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

Reply via email to