On 9/8/2012 9:08 AM, Sergiu Dumitriu wrote:
On 09/08/2012 04:10 AM, Müller, Wolfgang wrote:
Hi all,
I want to generate some PDF from SVG via fop/batik from inside a web
application. I am using the Grails framework, BTW. Grails runs its
webapps inside a tomcat.
Exec summary: Something works as a script, does not work in the tomcat,
need idea where things could go wrong. PDF gets generated both times,
but no custom fonts when using webapp.
Long version: I took some of the sample code, wrote a small Groovy
script that creates a transformer (no, i.e. default configuration),
feeds it with the proper input/output streams and creates the output.
Fonts are correct in the file generated. I also get plenty of output
that shows that fop is configuring its fonts from the fonts on my
machine. Great stuff.
It also generates a .fop directory in my home and puts font caches in
there.
Great.
Webapp: Now, for testing, I put a subset of the code into the
bootstrapping code of the webapp. It creates a transcoder and
transcodes an example svg string. It does a default font configuration,
but completely ignores the fonts on my machine and also does not create
anywhere a .fop directory.
Depending on how your tomcat is configured, one problem that I've
encountered in the past is that on some Linux distributions Tomcat
runs as the "tomcat" user, and that user doesn't have a home folder
where it can write. FOP tries to create a .fop directory in the home
folder of the current user, and since that's not possible, it fails to
register fonts.
Just to check if this is what's happening in your case, you could
configure tomcat to run as the root user. However, for security
reasons don't just leave it running as root, switch back to the tomcat
user and try configure a writable home directory for it.
Another possible cause is that you didn't specify an absolute path to
the custom fonts, and FOP looks for them starting from a different
directory.
From the documentation I did not really understand what happens. Also
setting log level to trace does not help.
Any suggestions? I would also be thankful for points of documentation
where I could learn more. I thought "fontconfig" would be the place, but
I don't see my problem represented there.
Cheers,
Wolfgang
Hi, Wolfgang-
You might also try defining user.home as a system property of the Tomcat
JVM (e.g. -Duser.home=c:\fop) and checking to ensure the Tomcat user has
write access to that directory.
-Terence Bandoian
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org