Hi,
We are having a particularly hard time trying to get FOP to embedd
"Trebuchet MS" in to the result PDF.
We successfully use FOP as a tomcat servlet however it seems that something
goes wrong when i try to add a configuration file for the servlet:
public void init() throws ServletException {
this.log = new SimpleLog("FOP/Servlet");
log.setLevel(SimpleLog.LOG_LEVEL_WARN);
this.uriResolver = new
ServletContextURIResolver(getServletContext());
this.transFactory = TransformerFactory.newInstance();
this.transFactory.setURIResolver(this.uriResolver);
//Configure FopFactory as desired
this.fopFactory = FopFactory.newInstance();
File temp = new File("E:/FOPCONF/testconfig.xml");
this.fopFactory.setUserConfig(temp);
this.fopFactory.setFontBaseURL("file:///E:/FOPCONF/");
this.fopFactory.setURIResolver(this.uriResolver);
configureFopFactory();
}
In particular its this line:
> this.fopFactory.setUserConfig(temp);
>
That throws an "Unhandled exception type SAXException", compiling seems to
work do so errorless and placing the new war file as tomcat servlet goes ok
as well and the servlet still works without errors however Trebuchet MS is
still not recognized.
Heres the E:/FOPCONF/testconfig.xml:
<?xml version="1.0"?>
<fop version="1.0">
<base>.</base>
<source-resolution>72</source-resolution>
<target-resolution>72</target-resolution>
<default-page-settings height="11in" width="8.26in"/>
<renderers>
<renderer mime="application/pdf">
<filterList>
<value>flate</value>
</filterList>
<fonts>
<font metrics-file="E:\FOPCONF\trebuc.xml" kerning="yes"
embed-file="E:\FOPCONF\trebuc.ttf">
<font-triplet name="Trebuchet MS" style="normal" weight="normal"/>
</font>
<font metrics-file="E:\FOPCONF\trebucbd.xml" kerning="yes"
embed-file="E:\FOPCONF\trebucbd.ttf">
<font-triplet name="Trebuchet MS" style="normal" weight="bold"/>
</font>
<font metrics-file="E:\FOPCONF\trebucbi.xml" kerning="yes"
embed-file="E:\FOPCONF\trebucbi.ttf">
<font-triplet name="Trebuchet MS" style="italic" weight="bold"/>
</font>
<font metrics-file="E:\FOPCONF\trebucit.xml" kerning="yes"
embed-file="E:\FOPCONF\trebucit.ttf">
<font-triplet name="Trebuchet MS" style="italic" weight="normal"/>
</font>
</fonts>
</renderer>
<renderer mime="application/postscript">
</renderer>
<renderer mime="application/vnd.hp-PCL">
</renderer>
<renderer mime="image/svg+xml">
<format type="paginated"/>
<link value="true"/>
<strokeText value="false"/>
</renderer>
<renderer mime="application/awt">
</renderer>
<renderer mime="image/png">
</renderer>
<renderer mime="image/tiff">
</renderer>
<renderer mime="text/xml">
</renderer>
<renderer mime="text/plain">
<pageSize columns="80"/>
</renderer>
</renderers>
</fop>
Could someone please guide me trough how to add "Trebuchet MS" to my PDF
output ?
It would be much appreciated !