atom feed2 messages in org.apache.xmlgraphics.fop-usersRe: Using binary image data in an emb...
FromSent OnAttachments
Phillip B OldhamMar 25, 2009 3:28 am 
Jeremias MaerkiMar 25, 2009 6:06 am 
Subject:Re: Using binary image data in an embedded environment
From:Jeremias Maerki (de@jeremias-maerki.ch)
Date:Mar 25, 2009 6:06:54 am
List:org.apache.xmlgraphics.fop-users

The solution with the RFC 2397 data URLs is one possibility as you've already found. Another would be to write your own URIResolver implementation that you can set on the FOUserAgent. In your FO you'd simply put the filenames after a custom URI scheme (ex. "my:" or "img:") on which your URIResolver would react by returning a StreamSource instance that has an InputStream that accesses the binary data.

Example: filename: image1.jpg --> URI: img:image1.jpg

There's a test case in FOP test suite that demonstrates this. The code can be simplified in your case. http://svn.eu.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/URIResolutionTestCase.java?view=markup http://svn.eu.apache.org/viewvc/xmlgraphics/fop/trunk/test/xml/uri-resolution1.fo?view=markup

HTH

On 25.03.2009 12:29:22 Phillip B Oldham wrote:

I'm using apache fop in an embedded environment; a stand-alone application receives an object with two attributes - the first is an FO string, the second is a list of image objects which themselves contain a filename and the binary data for that file.

I can generate the FO using the string, but I'm unable to find any documentation on how to load the binary files into fop and link to them in the FO to have them render in-place. At the moment I'm using the "data:" url scheme and "fo:instream-foreign-object", but these aren't optimal for my needs.

Can anyone provide an example of what I need to do, or point me in the right direction for a tutorial/reference/documentation?

Thanks.