xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: ConvertDOM2SVG
Date Wed, 16 May 2007 09:35:54 GMT
The SVG Renderer has not been resurrected for FOP Trunk/0.93, yet.
That's why you get this error message. I've got half an implementation
on my notebook that uses Batik's SVGGraphics2D and FOP's Java2DRenderer.
I can dump what I have in FOP's sandbox. Maybe it would help you but no
guarantees.

FOP 0.20.5 has SVG output but the quality is questionable and going back
to 0.20.5 is not attractive.

I'll see if I can commit my SVG changes later today.

On 15.05.2007 11:12:52 ayadi ines wrote:
> I want to generate an SVG file from a DOM 
> so I have tried this method but it generte the folowing exception
> java.lang.UnsupportedOperationException: Don't know how to handle "image/svg+xml" as
an output format. Neither an FOEventHandler, nor a Renderer could be found for this output
format.
>     at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:224)
>     at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:98)
>     at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:147)
>     at org.apache.fop.apps.Fop.<init>(Fop.java:82)
>     at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:227)
>     at antidote.apps.DOM2SVG.convertDOM2SVG(DOM2SVG.java:43)
>     at antidote.apps.Antidote.processXmlFiles(Antidote.java:227)
>     at antidote.apps.Antidote.run(Antidote.java:104)
>     at antidote.apps.Antidote.main(Antidote.java:111)
> 
> and this is the method
>  public void convertDOM2SVG(Document xslfoDoc, File svg) {
>         try {
>             FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
>             // configure foUserAgent as desired
>     
>             // Setup output
>             OutputStream out = new java.io.FileOutputStream(svg);
>             out = new java.io.BufferedOutputStream(out);
>     
>             try {
>                 // Construct fop with desired output format and output stream
>                 Fop fop = fopFactory.newFop(MimeConstants.MIME_SVG, foUserAgent, out);
>                 
>                 // Setup Identity Transformer
>                 TransformerFactory factory = TransformerFactory.newInstance();
>                 Transformer transformer = factory.newTransformer(); // identity transformer
>                 
>                 // Setup input for XSLT transformation
>                 Source src = new DOMSource(xslfoDoc);
>                 
>                 // Resulting SAX events (the generated FO) must be piped through to FOP
>                 Result res = new SAXResult(fop.getDefaultHandler());
>                 
>                 // Start XSLT transformation and FOP processing
>                 transformer.transform(src, res);
>             } finally {
>                 out.close();
>             }
>             
>         } catch (Exception e) {
>             e.printStackTrace(System.err);
>             System.exit(-1);
>         }
> 
>     }
> i will be grateful if someone can help me
> thanks
> 
> 
> 



Jeremias Maerki


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


Mime
View raw message