On 13.08.2004 16:22:40 Peter Verhoye wrote: > Hi all, > > I'm just starting to work with FOP so bear with me :-) (I already looked > through the archive but I could have missed the answer though) > > Anyway, I'm working on a project where I need to include an image into a > PDF generated using FOP. > Now, the component I use to generate the image writes the image (a JPEG) > to the filesystem. So, I could include it using the standard method. > However, since I'm not so pro creating files, I am looking for a way to > be able to generate the image at runtime using for example extensions. > > So the idea is to create an extension that calls a component, which > generates the image, and then it's done *ahem* > > However, looking at the xalan site, I saw that extensions always need to > return a String, a DOM element or such thing...
For this you don't create a Xalan extension as this only works during XSLT stage and is completely XML-related. You'd rather create a FOP extension that creates ImageArea instances. An example of a similar extension is my barcode extension from Barcode4J: http://barcode4j.krysalis.org http://cvs.sourceforge.net/viewcvs.py/barcode4j/barcode4j/src/fop-0.20.5/java/org/krysalis/barcode4j/fop0205/ The extension creates an SVGArea but that is very similar to creating an ImageArea. General instructions for writing FOP extensions can be found here: http://xml.apache.org/fop/dev/extensions.html > So now my question is, can it be done? And, if so, how (all help is > welcome so pointers are good too :-) If you want to make your life easier you could also think about using a Servlet instead of a FOP extension if that's possible in your case. This way you could generate the image using an URL in an fo:external-graphic element. Another possibility could be to modify the FopImageFactory in the org.apache.fop.images package. But that would probably not be so elegant. I hope this helps. Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]