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 Balaji Loganathan <ba...@yahoo.com> on 2002/08/07 09:22:29 UTC

Re: Embedde

Hi,
 Another hard try.. If u look at Velocity,their is an
examaple SampleServlet2.java which loads the
neccessary templates(.vm file) from jar file located
under lib directroy,mey be that will give u an idea on
how to code to loading file objects from jar files.

Regards
Balaji


http://digital.yahoo.com.au - Yahoo! Digital How To
- Get the best out of your PC!

Re: Embedded Fonts in FOP 0.20.3

Posted by Jon Kofal <jo...@yahoo.com>.
Problem solved.

I don't want to tie myself to a Servlet container, so placing the files
in TOMCAT/bin doesn't work.

What I did is put the userconfig.xml, and all my font.xml and font.dtd
files in my jar file.

My userconfig.xml has the base filenames of the .xml and .ttf files
(metrics-file="MyFont.xml" embed-file="MyFont.ttf").

I access the XML Elements at XPATH //font and add the value of the
javax.servlet.context.tempdir + a file.separator to the front of the
Attribute Value, adding a file:// to the font-metrics to match the
peculiar FOP protocol.  (I end up with
(metrics-file="file:///tempDir/MyFont.xml"
embed-file="/tempDir/MyFont.ttf").

I then read all the files from the jar (.xml and .ttf) and write them
to the javax.servlet.context.tempdir.

I write this userconfig.xml to the javax.servlet.context.tempdir.

I then instantiate a org.apache.fop.apps.Options with the just written
userconfig.xml.

This is a pain, but it works.

I'll recommend to the FOP developers to allow for Resources from the
JAR file, not just inflexible File objects.

Jon K



__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com