xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Monsorno <monso...@gmx.de>
Subject Re: where to put graphics referenced by external-graphic
Date Wed, 09 Jan 2002 10:26:37 GMT
(I'm sending this again, because it has never shown up in my INBOX
- sorry if it is by fault)

Martin Monsorno <Martin.Monsorno@exolution.de> writes:

> Hi *,
>
> I'm writing on a wep application which creates PDF document with
> fop. These documents should contain a graphic, I try to insert it with
> the <fo:external-graphic>-element.  The problem is now, how I can
> reference the graphic.
>
> The graphic-file should lie on the server, but it's not possible to
> use an absolute http-URL, because the server-name may not be known
> everytime. I tried to use a file://-URL, but this is also not possible
> for relative URLs, because I do not know the absolute path in any
> case, and furthermore I don't know where FOP assumes the
> root-directory (FOP is started from a servlet!).
>
> Does anybody has a solution to this problem? E.g. Is it possible to use
> relative URLs with this element?

OK - thanks to Chris and Kašpar for their answers - I try to explain
the problem after playing around with their suggestions:

The problem with the http://localhost...-URL is, that I do not know
the port-name in any case. So if the http server will run on an other
port, this will not work. (if not, it works, yes)

When I use src="file:..."-syntax, the problem remains, that I do not
know the absolute path, and I do not know the actual directory. I
tried to put the image into any directory of my project, but FOP
always complains with the message:

    [ERROR]: Error while creating area : Invalid Image URL - error on
    relative URL : no protocol: nullimage.jpg

(when using src="file:image.jpg". I also tried src="file:./image.jpg",
the error message changes to "no protocol: null./image.jpg".

BTW: Why is FOP complaining about "no protocol", when it doesn't find
a file? (it is the same error message when using a http-URL)

I tried this with FOP 0.20.1 and 0.20.2.

A possible workaround would be to insert the host and port (or use
localhost and insert port) into the fop-xsl-file when building or when
reading the file and handling it over to FOP, but thats awful.

-- 
Martin Monsorno
mailto:monsorno@gmx.de

Mime
View raw message