Hi,

I have a dynamically generated SVG image (using Batik included with the FOP 
distribution) and I want to pass the SVG (say as a bytearrayoutputstream) into 
the render process.  The render process is typical: 

bufferedOutputStream = new BufferedOutputStream( new FileOutputStream( 
outputPDFFile ) );
fop = fopFactory.newFop( org.apache.xmlgraphics.util.MimeConstants.MIME_PDF, 
foUserAgent, bufferedOutputStream );
transformer = TransformerFactory.newInstance().newTransformer( new 
StreamSource( xslStylesheet ) );
source = new StreamSource( xmlData );
result = new SAXResult( fop.getDefaultHandler() );
transformer.transform( source, result );

I've found the following two articles which have given me a bit of an idea:

http://old.nabble.com/How-to-transform-embedded-FO--td31231565.html
http://old.nabble.com/Embedding-SVG-dynamically-into-fo-file-td30691616.html

but I can't seem to figure out once I have my SVG as a bytearraystream what to 
do with it:

SAXSource saxSource = new SAXSource( new InputSource( new ByteArrayInputStream( 
byteArrayOutputStream.toByteArray() ) ) );

Where do I put the saxSource?

At the other end, what tag/block do I use in the XSL file to place the SVG?  
Currently I pull in an SVG file using the tag

<fo:block background-image="url('background.svg')" background-repeat="repeat" 
background-position-horizontal="center" background-position-vertical="center" >

which is fine for the file version...but not sure what to do for a dynamically 
generated version.

>From what I've read it should be possible to create an SVG on the fly and pass 
>it into the render process...just can't join all the dots!


Thanks in advance,

Bernard.


                                          

Reply via email to