You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Robert P. J. Day" <rp...@mindspring.com> on 2003/05/10 00:33:07 UTC

graphics, PNG files, JIMI and JAI

  in my simple docbook document, i've added a couple figures,
one with a JPG file (renders nicely), one with a PNG file (does
not render at all).  both show up in the .fo file as a 
fo:external-graphic, so i know *that* part of it is correct.
 
  from what i read in the FOP FAQ, PNG support is provided by
either JIMI or JAI.  in fact, i have both installed and their
jar files on my java CLASSPATH.

  the FAQ graphics entry for JIMI is a bit confusing, since
it suggests that i should install the JimiProClasses.zip file
(actually, i'm using the jar file) in the directory
xml-fop/lib/jimi-1.0.jar.  why is it not sufficient to put
the Jimi jar file on my CLASSPATH?

  and what's with the xml-fop directory?  where is *that*
supposed to be?  again, both the jimi and jai jar files are
on my classpath.  shouldn't that be sufficient?

  in addition, my FOP output contains:

... snip ...
[INFO] [10]
[INFO] Failed to load JAI, using Jimi instead
[ERROR] Error while creating area : Error creating FopImage object (Error creating FopImage object (file:stylesheet-images/tip.png) : org.apache.fop.image.JimiImage
[ERROR] Error while creating area : Error creating FopImage object (Error creating FopImage object (file:stylesheet-images/note.png) : org.apache.fop.image.JimiImage
[ERROR] Error while creating area : Error creating FopImage object (Error creating FopImage object (file:stylesheet-images/important.png) : org.apache.fop.image.JimiImage
[ERROR] Error while creating area : Error creating FopImage object (Error creating FopImage object (file:stylesheet-images/caution.png) : org.apache.fop.image.JimiImage
[ERROR] Error while creating area : Error creating FopImage object (Error creating FopImage object (file:stylesheet-images/warning.png) : org.apache.fop.image.JimiImage

... more snip ...

[ERROR] Error while creating area : Error creating FopImage object (Error creating FopImage object (file:cover.png) : org.apache.fop.image.JimiImage
[WARNING] Some static content could not fit in the area.
[WARNING] Some static content could not fit in the area.
[INFO] Parsing of document complete, stopping renderer
rm -rf ./stylesheet-images
cp -a `xmlcatalog /etc/xml/catalog http://docbook.sourceforge.net/release/xsl/current | sed -e 's,^file://,,'`/images ./stylesheet-images


  i'm not sure why JAI is failing to be loaded.  if i could solve that,
perhaps i'd get my PNG, no?

rday


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


RE: graphics, PNG files, JIMI and JAI

Posted by Victor Mote <vi...@outfitr.com>.
Robert P. J. Day wrote:

> > If you are using a home-grown script that is fine. However, I
> suspect that
> > you are actually using fop.bat or fop.sh at some point.
>
> in fact, i'm using neither fop.sh nor fop.bat.  given the number of
> java tools i'm using (xerces, xalan, saxon, etc.), i have a single
> directory where i keep all those jar files, and my CLASSPATH contains
> all of the relevant jar files.  so far, it's worked fine, until i
> got to FOP.

OK, so go back to my first statement: "If you are using a home-grown script
that is fine." So, if you're smart enough to write your own script, then we
can at least hope that you are smart enough to debug one. Use whatever
method you like. IMO, the easiest way to do that in this situation is to
first do it the way that works for thousands of other people, then
systematically figure out what is different between that approach and the
approach you are trying to use. It frankly seems abusive to say "I
understand the instructions, but refuse to follow them, and insist that
someone help me design an approach that suits me better." There are people
who can do that for a fee (FOP developers among them), but I don't feel any
obligation to customize your installation for you for free.

> > If so, then a cursory examination of those scripts will show that FOP
> > doesn't use your classpath at all, but builds its own. This is important
> > for some of the dependencies (like Batik) that require a very specific
> > version number to work correctly with FOP. So, you can hack fop.sh if
> > you wish, but if you do, then make sure you hack build.xml as well,
> > because otherwise if you try to build FOP from source down the road, you
> > will do so without JIMI or JAI support. IMO, it is really much better to
> > simply follow the instructions.
>
> while i can appreciate the version dependency issue, this strikes me as
> a *really* cumbersome and awkward approach.  i took at look at fop.sh,
> and from what i can see after first pass, there should be no difference
> between installing JIMI/JAI under the fop directory, or copying their
> respective jar files wherever i want, as long as the CLASSPATH is set
> correctly.

Well, it may be cumbersome and awkward, but usually we ignore such comments
unless they are accompanied by a suggestion for improvement. I see none.

Nevertheless, I agree in principle with your conclusion that it should run
if you are properly setting your CLASSPATH to point to it.

> forcing either JAI or JIMI to be installed under the fop directory
> for proper operation is, IMHO, a bad thing.  but perhaps i've just
> missed some final step that will make it work.  i'll give it another
> shot.

Well, nobody is forcing you to do that. We don't even force you to install
the FOP stuff in the FOP directory. You can extract class files & spread
them out all over tarnation if you wish. We have no way of preventing it and
no desire to do so.

Victor Mote


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


RE: graphics, PNG files, JIMI and JAI

Posted by "Robert P. J. Day" <rp...@mindspring.com>.
On Sat, 10 May 2003, Victor Mote wrote:

> Robert P. J. Day wrote:
> 
> >   in my simple docbook document, i've added a couple figures,
> > one with a JPG file (renders nicely), one with a PNG file (does
> > not render at all).  both show up in the .fo file as a
> > fo:external-graphic, so i know *that* part of it is correct.
> >
> >   from what i read in the FOP FAQ, PNG support is provided by
> > either JIMI or JAI.  in fact, i have both installed and their
> > jar files on my java CLASSPATH.
> >
> >   the FAQ graphics entry for JIMI is a bit confusing, since
> > it suggests that i should install the JimiProClasses.zip file
> > (actually, i'm using the jar file) in the directory
> > xml-fop/lib/jimi-1.0.jar.  why is it not sufficient to put
> > the Jimi jar file on my CLASSPATH?
> 
> If you are using a home-grown script that is fine. However, I suspect that
> you are actually using fop.bat or fop.sh at some point.

in fact, i'm using neither fop.sh nor fop.bat.  given the number of
java tools i'm using (xerces, xalan, saxon, etc.), i have a single 
directory where i keep all those jar files, and my CLASSPATH contains
all of the relevant jar files.  so far, it's worked fine, until i
got to FOP.


> If so, then a cursory examination of those scripts will show that FOP
> doesn't use your classpath at all, but builds its own. This is important
> for some of the dependencies (like Batik) that require a very specific
> version number to work correctly with FOP. So, you can hack fop.sh if
> you wish, but if you do, then make sure you hack build.xml as well,
> because otherwise if you try to build FOP from source down the road, you
> will do so without JIMI or JAI support. IMO, it is really much better to
> simply follow the instructions.

while i can appreciate the version dependency issue, this strikes me as
a *really* cumbersome and awkward approach.  i took at look at fop.sh,
and from what i can see after first pass, there should be no difference
between installing JIMI/JAI under the fop directory, or copying their
respective jar files wherever i want, as long as the CLASSPATH is set
correctly.

forcing either JAI or JIMI to be installed under the fop directory
for proper operation is, IMHO, a bad thing.  but perhaps i've just
missed some final step that will make it work.  i'll give it another
shot.

rday


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


RE: graphics, PNG files, JIMI and JAI

Posted by Victor Mote <vi...@outfitr.com>.
Robert P. J. Day wrote:

> i have, in fact, been testing this all morning.  despite the fact that i
> don't see how invoking FOP through fop.sh can make any logistical
> difference, i did copy the jai_core.jar file under the {fop}/lib
> directory, i used fop.sh, i verified that all .jar files under that
> directory are being prepended to the classpath that is used by the
> eventual call to FOP.
>
> so far, no go.  now, it may well be that i'm still doing something
> wrong, but frankly, it should *not* be this hard.  despite my adding
> both JIMI and JAI to my classpaths, and copying them under {fop}/lib,
> neither of those libraries are managing to render a simple .png
> file.
>
> i'm open to any suggestions as to how to isolate the problem here.

OK, you have me convinced that we might have a FOP problem here. Let's start
by copying the other JAI files into the {fop-install-dir}/lib directory to
see if that makes a difference.

Also, I have to leave shortly & won't be back until probably Monday. So if
you don't get a response right away, please hang in there until either I get
back or someone else can pick up the thread.

Victor Mote


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


RE: graphics, PNG files, JIMI and JAI

Posted by "Robert P. J. Day" <rp...@mindspring.com>.
On Sat, 10 May 2003, Victor Mote wrote:

> Robert P. J. Day wrote:
> 
> > > Then, copy the file "JimiProClasses.zip" from the archive to
> > > {fop-install-dir}/lib/jimi-1.0.jar. Please note that FOP binary
> >
> > um ... i don't understand the idea of copying a .zip file to
> > a new location, and renaming it to be a .jar file.
> 
> cp tmp/xyz.zip xml-fop/lib/abc.jar
> 
> I'm not sure how this evolved, but I think the purpose for it must be so
> that the hard-coded build system can find them in the proper place. AFAIK,
> there is no problem with letting your CLASSPATH point to them in a different
> place if you are running but not building FOP. I could be wrong, which is
> why I think you need to isolate the difference between  your approach and
> the standard approach.

i have, in fact, been testing this all morning.  despite the fact that i 
don't see how invoking FOP through fop.sh can make any logistical 
difference, i did copy the jai_core.jar file under the {fop}/lib 
directory, i used fop.sh, i verified that all .jar files under that
directory are being prepended to the classpath that is used by the 
eventual call to FOP.

so far, no go.  now, it may well be that i'm still doing something
wrong, but frankly, it should *not* be this hard.  despite my adding
both JIMI and JAI to my classpaths, and copying them under {fop}/lib,
neither of those libraries are managing to render a simple .png
file.

i'm open to any suggestions as to how to isolate the problem here.

rday


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


RE: graphics, PNG files, JIMI and JAI

Posted by Victor Mote <vi...@outfitr.com>.
Robert P. J. Day wrote:

> > Then, copy the file "JimiProClasses.zip" from the archive to
> > {fop-install-dir}/lib/jimi-1.0.jar. Please note that FOP binary
>
> um ... i don't understand the idea of copying a .zip file to
> a new location, and renaming it to be a .jar file.

cp tmp/xyz.zip xml-fop/lib/abc.jar

I'm not sure how this evolved, but I think the purpose for it must be so
that the hard-coded build system can find them in the proper place. AFAIK,
there is no problem with letting your CLASSPATH point to them in a different
place if you are running but not building FOP. I could be wrong, which is
why I think you need to isolate the difference between  your approach and
the standard approach.

Victor Mote


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


RE: graphics, PNG files, JIMI and JAI

Posted by "Robert P. J. Day" <rp...@mindspring.com>.
On Sat, 10 May 2003, Victor Mote wrote:

> Then, copy the file "JimiProClasses.zip" from the archive to
> {fop-install-dir}/lib/jimi-1.0.jar. Please note that FOP binary

um ... i don't understand the idea of copying a .zip file to
a new location, and renaming it to be a .jar file.

is there something happening here i should know about?

rday


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


Re: graphics, PNG files, JIMI and JAI

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Robert P. J. Day wrote:
> at this point, i'm thoroughly confused as to why neither JIMI nor JAI
> is successful at rendering a simple .png file.


Did you get the binary distribution or did you build FOP from
source? In case of the latter, Jimi/JAI must be present at build
time, otherwise support files are not compiled.

J.Pietschmann


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


RE: graphics, PNG files, JIMI and JAI

Posted by Victor Mote <vi...@outfitr.com>.
Robert P. J. Day wrote:

> it would make no difference since, if you take a close look at
> the loop in fop.sh, the fop/lib jar files are being *prepended*
> anyway.
>
> the end result would be the same.

You are right again. I'll get a cup of coffee before I try to "help" further
:-) Sorry for the noise.

Victor Mote


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


RE: graphics, PNG files, JIMI and JAI

Posted by "Robert P. J. Day" <rp...@mindspring.com>.
On Sat, 10 May 2003, Victor Mote wrote:

> Robert P. J. Day wrote:
> 
> > > If you are using a home-grown script that is fine. However, I
> > suspect that
> > > you are actually using fop.bat or fop.sh at some point. If so, then a
> > > cursory examination of those scripts will show that FOP doesn't use your
> > > classpath at all, but builds its own.
> >
> > technically, only half true since FOP initially assigns its LOCALCLASSPATH
> > *from* your CLASSPATH, so certainly, if you have an archive on your
> > standard CLASSPATH, it will show up in the call through fop.sh.
> 
> Ouch. You are correct. My humble apologies. Thanks for setting me straight,
> and this triggers the following off-topic thought:
> 
> <off-topic> Does anyone else think that we should move the following lines
> 
> if [ -n "$CLASSPATH" ] ; then
>   LOCALCLASSPATH=$CLASSPATH
> fi
> 
> to a point below the remainder of the LOCALCLASSPATH building, changing the
> middle line to:
>   LOCALCLASSPATH=$LOCALCLASSPATH:$CLASSPATH
> 
> This would make sure that the FOP-supported libraries appear in the
> CLASSPATH before any user CLASSPATH entries.

it would make no difference since, if you take a close look at
the loop in fop.sh, the fop/lib jar files are being *prepended*
anyway.

the end result would be the same.

rday



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


RE: graphics, PNG files, JIMI and JAI

Posted by Victor Mote <vi...@outfitr.com>.
Robert P. J. Day wrote:

> > If you are using a home-grown script that is fine. However, I
> suspect that
> > you are actually using fop.bat or fop.sh at some point. If so, then a
> > cursory examination of those scripts will show that FOP doesn't use your
> > classpath at all, but builds its own.
>
> technically, only half true since FOP initially assigns its LOCALCLASSPATH
> *from* your CLASSPATH, so certainly, if you have an archive on your
> standard CLASSPATH, it will show up in the call through fop.sh.

Ouch. You are correct. My humble apologies. Thanks for setting me straight,
and this triggers the following off-topic thought:

<off-topic> Does anyone else think that we should move the following lines

if [ -n "$CLASSPATH" ] ; then
  LOCALCLASSPATH=$CLASSPATH
fi

to a point below the remainder of the LOCALCLASSPATH building, changing the
middle line to:
  LOCALCLASSPATH=$LOCALCLASSPATH:$CLASSPATH

This would make sure that the FOP-supported libraries appear in the
CLASSPATH before any user CLASSPATH entries. Probably good for Batik, maybe
not so good for Xalan. Or maybe we should split the lib directory into two
pieces & load the contents separately, one before and one after, so that we
could load version-critical things like Batik first, then load less
version-critical things like Xalan after.
</off-topic>

> at this point, i'm thoroughly confused as to why neither JIMI nor JAI
> is successful at rendering a simple .png file.

I guess I am too. Right before your "java" command that runs FOP, echo your
CLASSPATH to see what is actually in there.

Victor Mote


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


RE: graphics, PNG files, JIMI and JAI

Posted by "Robert P. J. Day" <rp...@mindspring.com>.
On Sat, 10 May 2003, Victor Mote wrote:

> If you are using a home-grown script that is fine. However, I suspect that
> you are actually using fop.bat or fop.sh at some point. If so, then a
> cursory examination of those scripts will show that FOP doesn't use your
> classpath at all, but builds its own.

technically, only half true since FOP initially assigns its LOCALCLASSPATH
*from* your CLASSPATH, so certainly, if you have an archive on your 
standard CLASSPATH, it will show up in the call through fop.sh.

at this point, i'm thoroughly confused as to why neither JIMI nor JAI
is successful at rendering a simple .png file.

rday


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


RE: graphics, PNG files, JIMI and JAI

Posted by Victor Mote <vi...@outfitr.com>.
Robert P. J. Day wrote:

>   in my simple docbook document, i've added a couple figures,
> one with a JPG file (renders nicely), one with a PNG file (does
> not render at all).  both show up in the .fo file as a
> fo:external-graphic, so i know *that* part of it is correct.
>
>   from what i read in the FOP FAQ, PNG support is provided by
> either JIMI or JAI.  in fact, i have both installed and their
> jar files on my java CLASSPATH.
>
>   the FAQ graphics entry for JIMI is a bit confusing, since
> it suggests that i should install the JimiProClasses.zip file
> (actually, i'm using the jar file) in the directory
> xml-fop/lib/jimi-1.0.jar.  why is it not sufficient to put
> the Jimi jar file on my CLASSPATH?

If you are using a home-grown script that is fine. However, I suspect that
you are actually using fop.bat or fop.sh at some point. If so, then a
cursory examination of those scripts will show that FOP doesn't use your
classpath at all, but builds its own. This is important for some of the
dependencies (like Batik) that require a very specific version number to
work correctly with FOP. So, you can hack fop.sh if you wish, but if you do,
then make sure you hack build.xml as well, because otherwise if you try to
build FOP from source down the road, you will do so without JIMI or JAI
support. IMO, it is really much better to simply follow the instructions.

>   and what's with the xml-fop directory?  where is *that*
> supposed to be?

I'll take the blame for that one. That should read {fop-install-dir}
instead. The xml-fop directory is the location in CVS, but it could be
installed anywhere on your system. I have fixed the doc for this in CVS (it
will be a few days before it shows up on the live site).

> again, both the jimi and jai jar files are
> on my classpath.  shouldn't that be sufficient?

Same story on JAI. Here is the revised (source) documentation for JIMI &
JAI:

      <section id="jimi">
        <title>JIMI</title>
        <p>
          Because of licensing issues, the JIMI image library is not
included in the FOP distribution. First, <fork
href="http://java.sun.com/products/jimi">download</fork> and install it.
Then, copy the file "JimiProClasses.zip" from the archive to
{fop-install-dir}/lib/jimi-1.0.jar. Please note that FOP binary
distributions are compiled with JIMI support, so there is no need for you to
build FOP to add the support. If jimi-1.0.jar is installed in the right
place, it will automatically be used by FOP, otherwise it will not.
        </p>
      </section>
      <section id="jai">
        <title>JAI</title>
        <p>
          FOP has been compiled with JAI support, but JAI is not included in
the FOP distribution.
To use it, install <link
href="http://java.sun.com/products/java-media/jai">JAI</link>, then copy the
jai_core.jar file to {fop-install-dir}/lib.
JAI is much faster than JIMI, but is not available for all platforms. See
<link
href="http://java.sun.com/products/java-media/jai/forDevelopers/jaifaq.html#
platforms">What platforms are supported?</link> on the JAI FAQ page for more
details.
        </p>
      </section>

>   in addition, my FOP output contains:
>
> ... snip ...
> [INFO] [10]
> [INFO] Failed to load JAI, using Jimi instead
> [ERROR] Error while creating area : Error creating FopImage
> object (Error creating FopImage object
> (file:stylesheet-images/tip.png) : org.apache.fop.image.JimiImage
> [ERROR] Error while creating area : Error creating FopImage
> object (Error creating FopImage object
> (file:stylesheet-images/note.png) : org.apache.fop.image.JimiImage
> [ERROR] Error while creating area : Error creating FopImage
> object (Error creating FopImage object
> (file:stylesheet-images/important.png) : org.apache.fop.image.JimiImage
> [ERROR] Error while creating area : Error creating FopImage
> object (Error creating FopImage object
> (file:stylesheet-images/caution.png) : org.apache.fop.image.JimiImage
> [ERROR] Error while creating area : Error creating FopImage
> object (Error creating FopImage object
> (file:stylesheet-images/warning.png) : org.apache.fop.image.JimiImage
>
> ... more snip ...
>
> [ERROR] Error while creating area : Error creating FopImage
> object (Error creating FopImage object (file:cover.png) :
> org.apache.fop.image.JimiImage
> [WARNING] Some static content could not fit in the area.
> [WARNING] Some static content could not fit in the area.
> [INFO] Parsing of document complete, stopping renderer
> rm -rf ./stylesheet-images
> cp -a `xmlcatalog /etc/xml/catalog
> http://docbook.sourceforge.net/release/xsl/current | sed -e
> 's,^file://,,'`/images ./stylesheet-images

Let's see how much of this is cleaned up when you let FOP find the classes
it needs.

Victor Mote


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