I save an SVG file and i would like for it to be formatted nicely... Here is my code 
some code is left out to make things simple ... i wasnt sure how to add a 
PrettyPrinter as the code i have commented out throws an exception...

    public static void saveXMLDocAsSVG(Document document) throws 
org.apache.batik.transcoder.TranscoderException{
        
        input = new TranscoderInput(svgCanvas.getSVGDocument());
        
        ////////////
        File f = JFileChooser to pick what to save it as.
        ////        
                try 
                {
                    writer = new PrintWriter(new FileOutputStream(f));
                }
                catch(FileNotFoundException e) {
                    e.getMessage();
                }
                catch(IOException e) {
                    e.getMessage();
                }
                
                try {
                    /*org.apache.batik.transcoder.svg2svg.PrettyPrinter newpp = new 
org.apache.batik.transcoder.svg2svg.PrettyPrinter();
                    newpp.print(input.getReader(), writer);
                    newpp.setTabulationWidth(5);
                    */
                     DOMUtilities.writeDocument( svgCanvas.getSVGDocument(), writer);
                }
                catch(IOException e) {
                    e.getMessage();
                }
                
                writer.flush();
                writer.close();
        
    }//end save


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

Reply via email to