Hi Jeremias ,
I found your response very useful. I have rewritten my code to use UserAgent
we were using some old methods of FOP which are now deprecated. I am now
back to getting the PDF generated correctly, after code restructuring. I am
setting the base URL as follows:
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setBaseURL("./");
I want the base URL to be where the .xsl file is currently located in the
Eclipse project, not a hardcoded absolute path like the one in the example
in the links provided below, which suggest:
userAgent.setBaseURL("file:///C:/Temp/");
If I did this only the machine running the application with this folder
structure will be able to set the base URL all other machines will not. so I
set the base URL as userAgent.setBaseURL("./");
However when trying to generate PDF I get in the console:
[ INFO] 03/26/08 10:10:31 >:
FOP base url is ./
[ERROR] 03/26/08 10:10:32 >:
Error with base URL "./"): no protocol: ./
I have placed the logo.gif in the same directory in Eclipse as the .xsl
file, but it doesnt seem to like the base URL. Anybody know how to set
baseURL to current location of .xsl.
I really appreciate any help.
Regards.
Jeremias Maerki-2 wrote:
>
> What you're using is not a relative URL! It's actually an absolute
> filename which FOP internally converts to an absolute file URL. The
> leading slash makes it an absolute filename/URL.
>
> A relative URL is this, for example:
>
> <fo:external-graphic src="images/myimage.png"/>
>
> Any relative URI/URL for images is then resolved against the base
> URI/URL specified in the configuration. See "base" in:
> http://xmlgraphics.apache.org/fop/stable/configuration.html#general-elements
>
> Or "FOUserAgent.setBaseURL(String)":
> http://xmlgraphics.apache.org/fop/stable/embedding.html#user-agent
>
> On 26.03.2008 03:35:16 meghnas wrote:
>>
>> HI All,
>>
>> I have been generating a PDF file using FOP, I want to put a gif onto the
>> PDF. I can do this but only when the .gif file is on the C:/ drive of the
>> machine. I want to use relative path, so that it works for all users.
>> When I put the logo.gif in my c:/ drive and have the code as below it
>> works:
>>
>> <fo:table-row>
>> <fo:table-cell number-columns-spanned="5">
>> <fo:block text-align="left">
>> <fo:external-graphic content-width="2.08in" content-height="0.72in"
>> src='url("/logo.gif")' />
>> </fo:block>
>> </fo:table-cell>
>> </fo:table-row>
>>
>> I am looking for the syntax to use for src='url("/logo.gif")'
>> Notice the single outer quotes and the double inner quotes - it only
>> works
>> this way for me. My <xsl:stylesheet version="1.0"> and also xml version
>> is
>> 1.0. The .gif file is actually in my Eclipse project workspace under
>> WebContent, I am just not sure how I can refer to it using relative path.
>> I
>> have tried various different syntax combinations, but have been
>> unsuccessful.
>>
>> Would really appreciate it, if someone could give me an example of using
>> relative path, particularly specifying where they put the actual .gif
>> file.
>> I am interested specifically in where the .xsl file is located and where
>> the
>> .gif is located, and the syntax of the src property.
>>
>> Any help, will be much much appreciated!
>>
>> Thanks.
>> --
>> View this message in context:
>> http://www.nabble.com/Relative-URL-for-embedding-graphics-in-FOP-tp16294358p16294358.html
>> Sent from the FOP - Users mailing list archive at Nabble.com.
>>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Relative-URL-for-embedding-graphics-in-FOP-tp16294358p16302994.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]