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 Will Peterson <wp...@novell.com> on 2004/01/12 18:39:18 UTC

Rendering images from a JAR file

Would there be any way to have FOP render files from a JAR file?

 
I have created a program that allows me to point to a XSL:FO (template)
file in a jar file, and to render the file to PDF.  However, I have not
been able to point to the images (for example JPG, GIF) that are "in"
the JAR file.
 
Is there a way to set up the driver to point to a directory into the
JAR file, or would I have to extract the files first.
 
Thanks,
 
- Will
 
 
 
 

RE: Rendering images from a JAR file

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Will Peterson [mailto:wpeterson@novell.com]

> Would there be any way to have FOP render files from a JAR file?
>
> I have created a program that allows me to point to a XSL:FO (template)
file in a jar file,
> and to render the file to PDF.  However, I have not been able to point to
the images
> (for example JPG, GIF) that are "in" the JAR file.
>
> Is there a way to set up the driver to point to a directory into the JAR
file,
> or would I have to extract the files first.


It is possible, and sounds a bit like a thread from about 2-3 months ago...
How is your Java?

At that time it was suggested that we change our
org.apache.fop.image.GifImage class, namely the loadImage() method, right
after opening the first try-block:

Replace this:
ImageProducer ip = (ImageProducer)this.m_href.getContent();

by this:
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image = toolkit.getImage(m_href);
ImageProducer ip = image.getSource();

As I said to the OP at that time, the suggestion sounded good although I
wasn't too sure whether there were other issues involved. Right now it still
hasn't found its way into the sources, I'm afraid.


Hope this helps!

Cheers,

Andreas