You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Eyrignoux Marc <ey...@yahoo.fr> on 2002/08/23 09:09:04 UTC

Question about SVG

Hello everybody,

I would like to put some nice graphics in my PDF docs.

By now I am generating my PDF using FOP, with an XML
stream and an XSL stylesheet.
I have also a library generating SVG streams.

Is there a "best way" to have everything communicating
?

My first guess would be to put the SVG stream within
the XSL stream, but I am not sure it is very easy, nor
nice.
I have also tried to put the SVG stream into the XML
document (easier), but that doesn't work: XSLT tries
to interpret the svg tags => there is nothing in the
FO stream.

Thanks in advance,
Marc.

NB: I don't want to generate files.

Here is the sample code for generating my SVG stream
using JFreeChart (JFreeChart is a free library for
drawing charts):
 
           OutputStreamWriter writer = new
 OutputStreamWriter(out);
 
           // Get a DOMImplementation
           DOMImplementation domImpl =
 GenericDOMImplementation.getDOMImplementation();
           // Create an instance of
 org.w3c.dom.Document
           org.w3c.dom.Document document =
 domImpl.createDocument(null, "svg", null);
 
           /// Create an SVG Context to customise
           SVGGeneratorContext ctx =
 SVGGeneratorContext.createDefault(document);
           ctx.setComment("Generated by JFreeServlet
 using Batik SVG Generator");
 
           // Create an instance of the SVG Generator
           SVGGraphics2D svgGenerator = new
 SVGGraphics2D(ctx, false);
           svgGenerator.setSVGCanvasSize(new
 Dimension(width,height));
           chart.draw(svgGenerator, new
 Rectangle2D.Double(0, 0, width, height), null);
           svgGenerator.stream(writer, false);
 



=====
C'est au pied du mur qu'on voit le mieux le mur.

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Question about SVG

Posted by Keiron Liddle <ke...@aftexsw.com>.
Hi Marc,

Your choices for including SVG are via an external graphic which would
mean a file or by embedding the SVG XML inside the xsl:fo.
If you can get the SVG into the XML then it is simply a matter of
getting XSLT to pass the SVG through. You should be able to use a copy
all thing for your SVG. Try asking on an XSLT list if you have any
problems.

Keiron.

On Fri, 2002-08-23 at 09:09, Eyrignoux Marc wrote:
> Hello everybody,
> 
> I would like to put some nice graphics in my PDF docs.
> 
> By now I am generating my PDF using FOP, with an XML
> stream and an XSL stylesheet.
> I have also a library generating SVG streams.
> 
> Is there a "best way" to have everything communicating
> ?
> 
> My first guess would be to put the SVG stream within
> the XSL stream, but I am not sure it is very easy, nor
> nice.
> I have also tried to put the SVG stream into the XML
> document (easier), but that doesn't work: XSLT tries
> to interpret the svg tags => there is nothing in the
> FO stream.
> 
> Thanks in advance,
> Marc.
> 
> NB: I don't want to generate files.
> 
> Here is the sample code for generating my SVG stream
> using JFreeChart (JFreeChart is a free library for
> drawing charts):



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org