Hi, Here is how you use PrettyPrinter. You are not invoked PrettyPrinter directly, instead use SVGTrancoder which utilize Pretty Printer.
Here is sample code Transcoder transcoder = new SVGTranscoder(); TranscoderInput in = new TranscoderInput(doc); TranscoderOutput out = new TranscoderOutput(writer); //transcoder.setTranscodingHints(hints); set this if you want transcoder hint like tab, etc transcoder.transcode(in, out); Hope it helps you Regards Tonny Kohar On Tue, 2004-05-25 at 22:45, [EMAIL PROTECTED] wrote: > 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] -- Sketsa SVG Graphics Editor http://www.kiyut.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]