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 Peter Kalsch <ka...@informatik.fh-kl.de> on 2005/07/04 16:57:06 UTC
baseDir Problem with images
Hi all,
I want to generate a pdf with Fop with the help of velocity-servlets .
The application works fine and the the generating of pdf makes no
problems, without images in the vm-file. Now, I want to add an image. No
problem? A big problem for me, obviously! The application works fine
again, BUT the generated pdf-file displays no image.
What's going wrong?
1. entry in servlet init()-Method
...
new Options(new
File("/usr/local/tomcat/webapps/webAT/conf/userconfig.xml"));
...
2. Entry in "userconfig.xml":
<entry>
<key>baseDir</key>
<value>usr/local/tomcat/webapss/webAT/templates/pdf/</value>
</entry>
I tried a lot, like this
" <value>./webAT/templates/pdf/</value>"
or like this
"<value>/templates/pdf/</value>"
or like this
"<value>webAT</value>"
an so on
3. abs. Path to the vm-File on my testserver is
usr/local/tomcat/webapps/webAT/templates/pdf/test.vm
4. abs. Path to image
usr/local/tomcat/webapps/webAT/templates/pdf/logotr.gif --> the same
directory
5. vm-File:
snip
<fo:external-graphic height="16pt" scaling="uniform"
src="url('file:logotr.gif')"/>
snip
6. I'm looking in the mailing for similar problems. But all proposals to
solve the problem failed.
And whatever I try, I got more than less the same error:
"Error while creating area : Invalid Image URL - error on relative URL :
no protocol:
usr/local/tomcat/webapss/webAT/templates/pdf/logotr.gif"
Additionally, I tried an alternative:
servlet init()-Method :
snip
Configuration.put("baseDir", "file:" +
getServletContext().getRealPath("/WebAT/templates/pdf/") );
snip
errormessage:
"Error while recovering Image Informations
(file:/usr/local/tomcat/webapps/webAT/WebAT/templates/pdf/logotr.gif) :
/usr/local/tomcat/webapps/webAT/WebAT/templates/pdf/logotr.gif (No such
file or directory)"
further informations:
Eclipse 3.0.2
Apache Tomcat/5.0.28
FOP 0.20.5
Any idea? Have I overlooked a simple fault?
Thanks in advance
Peter
--
FACHHOCHSCHULE KAISERSLAUTERN STANDORT ZWEIBRUECKEN
Competence Center Instructional Design in Technology(CCIDT)
Geschäftsleitung
Dipl.-Inf.(FH) Peter Kalsch Amerikastrasse 1
D-66482 Zweibruecken
Tel. : +49-(0)6332/914-396
eMail: kalsch@informatik.fh-kl.de
www.ccidt.de
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: baseDir Problem with images
Posted by The Web Maestro <th...@gmail.com>.
On Jul 4, 2005, at 7:57 AM, Peter Kalsch wrote:
<snip>
> 6. I'm looking in the mailing for similar problems. But all proposals
> to solve the problem failed.
> And whatever I try, I got more than less the same error:
>
> "Error while creating area : Invalid Image URL - error on relative URL
> : no protocol:
>
> usr/local/tomcat/webapss/webAT/templates/pdf/logotr.gif"
>
>
> Additionally, I tried an alternative:
> servlet init()-Method :
> snip
> Configuration.put("baseDir", "file:" +
> getServletContext().getRealPath("/WebAT/templates/pdf/") );
> snip
> errormessage:
> "Error while recovering Image Informations
> (file:/usr/local/tomcat/webapps/webAT/WebAT/templates/pdf/logotr.gif)
> : /usr/local/tomcat/webapps/webAT/WebAT/templates/pdf/logotr.gif (No
> such file or directory)"
>
>
> further informations:
> Eclipse 3.0.2
> Apache Tomcat/5.0.28
> FOP 0.20.5
>
> Any idea? Have I overlooked a simple fault?
> Thanks in advance
> Peter
In my experience, the 'default' basedir is where the Source XML file is
stored. If you could place the graphics in a sub-directory of that
folder, it should work (unless you're streaming the XML...). One other
alternative I didn't see in your e-mail is using a URL instead of a
PATH.
Hope this helps!
Regards,
Web Maestro Clay
--
<th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
RE: baseDir Problem with images
Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Peter Kalsch [mailto:kalsch@informatik.fh-kl.de]
>
Hi,
<snip />
> 1. entry in servlet init()-Method
> ...
> new Options(new
> File("/usr/local/tomcat/webapps/webAT/conf/userconfig.xml"));
> ...
>
This obviously works...
> 2. Entry in "userconfig.xml":
> <entry>
> <key>baseDir</key>
> <value>usr/local/tomcat/webapss/webAT/templates/pdf/</value>
> </entry>
... but why do you use a relative path here? Try prepending a '/' to make it
absolute, see if that helps (?)
BTW: Did you notice the slight spelling-error? "webapss" instead of
"webapps"? (could also be the cause of your headaches...)
>
> 3. abs. Path to the vm-File on my testserver is
> usr/local/tomcat/webapps/webAT/templates/pdf/test.vm
Again: this is NOT an absolute path, but a relative one... (the root is
missing)
>
> 4. abs. Path to image
> usr/local/tomcat/webapps/webAT/templates/pdf/logotr.gif --> the same
> directory
Idem dito.
>
>
> 5. vm-File:
> snip
> <fo:external-graphic height="16pt" scaling="uniform"
> src="url('file:logotr.gif')"/>
> snip
IIC, this URL isn't valid. Should at least start with 'file://' (at least, I
remember vaguely from reading the related RFC, will have to look it up
myself to be sure...)
>
> 6. I'm looking in the mailing for similar problems. But all proposals to
> solve the problem failed.
> And whatever I try, I got more than less the same error:
>
> "Error while creating area : Invalid Image URL - error on relative URL :
> no protocol:
Et voilĂ , it is indeed a *relative* URL, not an absolute one.
>
> usr/local/tomcat/webapss/webAT/templates/pdf/logotr.gif"
>
>
> Additionally, I tried an alternative:
> servlet init()-Method :
> snip
> Configuration.put("baseDir", "file:" +
> getServletContext().getRealPath("/WebAT/templates/pdf/") );
To pull this off, I think you need just '.getRealPath("/templates/pdf/")'
> snip
> errormessage:
> "Error while recovering Image Informations
> (file:/usr/local/tomcat/webapps/webAT/WebAT/templates/pdf/logotr.gif) :
^^^^^^^^^^^^
See?
HTH!
Greetz,
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org