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 Menzel <pe...@imise.uni-leipzig.de> on 2003/01/31 14:45:17 UTC

userconfig.xml in servlet

Hi everybody!

I want to set FOPs userconfig.xml in the servlet, using these lines:

File userConfigFile = new
File(getServletContext().getResource("/WEB-INF/userconfig.xml").toExternalForm()
);
Otions options = new Options(userConfigFile);

this code compiles, but when running the servlet, I get an error:

[ERROR] Could not load user configuration file
jndi:\localhost\ow\WEB-INF\userco
nfig.xml - error: C:\Programme\Apache Group\Tomcat
4.1\jndi:\localhost\ow\WEB-IN
F\userconfig.xml (Syntax is wrong..)

What can I do?

Another question: I need the userconfig.xml, because I want to load an
additional font into FOP, which I created from an TTF file, and use these lines
in the userconfig.xml:
...
<fonts>
<font metrics-file="mtcorsiva.xml" kerning="yes">
  <font-triplet name="MTCORSIVA" style="normal" weight="normal">
</font>
...

I put the fonts xml file in the same dir as userconfig.xml. Is the correct?

Nice greetings, 
<Peter/>



-- 

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


Re: userconfig.xml in servlet

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Peter Menzel wrote:
> I cannot specify the basedir/fontbasedir in the userconfig.xml, because I do
> not know it.
> My web application will be deployed as a war file in some servlet container
> from which I do not know anything about directory structures..
> 
> Is there another way, to set the font basedir in FOP, or importing the fonts
> xml file directly in the servlet to the Options or Driver object? 

You can use org.apache.fop.configuration.Configuration.put("baseDir",
	getServletContext().getRealPath("/fop"));

See getRealPath() documentation.
-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel


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


Re: userconfig.xml in servlet

Posted by Peter Menzel <pe...@imise.uni-leipzig.de>.
I cannot specify the basedir/fontbasedir in the userconfig.xml, because I do
not know it.
My web application will be deployed as a war file in some servlet container
from which I do not know anything about directory structures..

Is there another way, to set the font basedir in FOP, or importing the fonts
xml file directly in the servlet to the Options or Driver object? 

<Peter/>
-- 

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


Re: userconfig.xml in servlet

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Peter Menzel wrote:

> I want to set FOPs userconfig.xml in the servlet, using these lines:
> 
> File userConfigFile = new
> File(getServletContext().getResource("/WEB-INF/userconfig.xml").toExternalForm()
> );
So check here whether such file exists:
if (userConfigFile.exists())
	Otions options = new Options(userConfigFile);

> What can I do?
Have you tried something like 
getServletContext().getRealPath("/config/userconfig.xml")

> Another question: I need the userconfig.xml, because I want to load an
> additional font into FOP, which I created from an TTF file, and use these lines
> in the userconfig.xml:
> ...
> <fonts>
> <font metrics-file="mtcorsiva.xml" kerning="yes">
>   <font-triplet name="MTCORSIVA" style="normal" weight="normal">
> </font>
> ...
> 
> I put the fonts xml file in the same dir as userconfig.xml. Is the correct?
No, you have to set up baseDir or fontBaseDir properties to resolve 
relative pathes. See faq: http://xml.apache.org/fop/faq.html#faq-N102DC.

-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel


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