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 Ashish Kulkarni <as...@gmail.com> on 2007/12/05 21:59:42 UTC

issue with adding image to pdf file, system cannot find the file specified error

Hi
I am trying to add image in a pdf file, i am working on windows and have the
jpg image and xsl style sheet in same folder
and in my xsl file i have the following image tag
<fo:block >
<fo:external-graphic src="url('myimage.jpg')"
content-height="0.5cm" content-width="0.5cm" display-align="center" />
</fo:block>

But i get following error
[ERROR] Error while creating area : Error with image URL: myimage.jpg (The
system cannot find the file specified) and no base URL is specified

I copied in the image in
C:\Documents and Settings\Userid which user.home , but still it does not
find the issue

How can i get it working, i cannot hardcode the path, since i am not sure
what it will be at runtime

Ashish

Re: issue with adding image to pdf file, system cannot find the file specified error

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
FOP doesn't look in the user.home just like that when it encounters a
relative URI/filename. If nothing special is done, the relative URIs are
resolved relative to the current directory. You can, however, override
the base directory/URI. This is described here:

Configuration file:
http://xmlgraphics.apache.org/fop/0.94/configuration.html
(see "base" setting)

Embedded use:
http://xmlgraphics.apache.org/fop/0.94/embedding.html#fop-factory
(see "fopFactory.setBaseURL()" or "userAgent.setBaseURL()")

On 05.12.2007 21:59:42 Ashish Kulkarni wrote:
> Hi
> I am trying to add image in a pdf file, i am working on windows and have the
> jpg image and xsl style sheet in same folder
> and in my xsl file i have the following image tag
> <fo:block >
> <fo:external-graphic src="url('myimage.jpg')"
> content-height="0.5cm" content-width="0.5cm" display-align="center" />
> </fo:block>
> 
> But i get following error
> [ERROR] Error while creating area : Error with image URL: myimage.jpg (The
> system cannot find the file specified) and no base URL is specified
> 
> I copied in the image in
> C:\Documents and Settings\Userid which user.home , but still it does not
> find the issue
> 
> How can i get it working, i cannot hardcode the path, since i am not sure
> what it will be at runtime
> 
> Ashish




Jeremias Maerki


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