forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <>
Subject Re: SVG images not displayed in PDFs using Forrest version 0.8
Date Thu, 18 Jan 2007 06:56:57 GMT
Steve Odlind wrote:
> >> Steve can you please try the example:
> >> my-new-sample
> >> forrest seed-sample
> >> forrest run
> >> http://localhost:8888/samples/linking.html#images
> >> and the PDF.
> >> Then try adding your example. Tell us what happens.
> My results were the same as yours for version 0.8. Only two images are
> shown in PDFs: item 4 in the first group and item 3 in the second group.
> All the images are displayed in HTML. 
> When I added my own examples, <img src="images/anImage.png" alt="PNG
> image"/> worked as desired (i.e. image displayed in HTML and PDF),

Yes, that is the same type of URI as the two that
work okay in the demo.

>  but
> <img src="images/anImage.svg alt="SVG image"/> caused an error message
> to be shown (see below).
> >> What is your localhost URI (i.e. the a@href) for the image
> >> that works for you in 0.7 version?
> The localhost URI of an image that does work in version 0.7 is
> src="../images/anImage.svg"

Oh, i thought that you were talking about PNGs generated from
SVG. Now i see that you use raw svg files in the final documents.

Yes if i try to do an in-line SVG img then i get the message
that you show below.

> I forgot to mention previously that I had added a new element called
> <figurepdf>. I can't use SVGs with any effects or colour gradients in
> PDFs due to some limitations in FOP. Therefore, I use the <figurepdf>
> element to include SVG images without these effects in PDF only, and use
> the <figure> element to include images with fancy effects in HTML. This
> worked fine in version 0.7. 
> However, it seems version 0.8 completely ignores both the <figure> and
> <figurepdf> elements when it generates the PDF (even though they are
> included in document-to-fo.xsl).

It doesn't "completely ignore". See localhost:8888/samples/
which shows that the <figure> is handled. Not correctly, but it
is handled.

>  The only way to include an image in the
> PDF is to use the <img> element.

FOR-635 shows that even then there are some troubles.

>  Now that I have changed the <figurepdf>
> elements to <img> elements I get the following error message when I
> execute the 'forrest' command (see attachment for the rest of the error
> message):
> ""
> Exception in thread "main" java.lang.NoSuchMethodError:
> org.apache.batik.bridge.
> UnitProcessor.createContext(Lorg/apache/batik/bridge/BridgeContext;Lorg/
> w3c/dom/Element;)Lorg/apache/batik/util/UnitProcessor$Context;
>         at
> org.apache.fop.image.analyser.SVGReader.loadImage(
> ...
> ""
> So, am I right in thinking that the reason SVGs are not displayed in
> PDFs has something to do with the Batik?

Perhaps. I see that the Batik-related jars were updated
in our trunk soon after the forrest-0.7 release (was 1.5.1
now 1.6). You could try your luck by swapping the jars.

> Also, why would Forrest ignore the <figure> element in PDFs? If you take
> a look at http://localhost:8888/samples/sample.html#figure, the image is
> not displayed in the PDF with the <figure> element, but if you change it
> to an <img> element it is displayed. This is odd, as both 'figure' and
> 'img' are matched in the same template in document-to-fo.xsl:
> "<xsl:template match="figure|img">" 

Do you mean when using 0.8-dev (SVN trunk)?
Hmmm, i do not observe that.

The use of img is demonstrated in an earlier section of
that page and works in pdf. However this is only because
it is one of the URIs that functions properly, i.e. a
relative reference.


View raw message