I
added font "Arial Narrow" to FOP on Windows 2000 server.
I
followed the instructions in FOP web site to generate font metrics xml file and
register it within FOP.
The
code in userconfig.xml is:
<!-- Arial Narrow -->
<font
metrics-file="file:///c:/fop/fop-0.20.4/fonts/arialn.xml"
kerning="yes" embed-file="c:\winnt\fonts\arialn.ttf">
<font-triplet
name="Arial Narrow" style="normal"
weight="normal"/>
<font-triplet
name="ArialMTN" style="normal"
weight="normal"/>
</font>
<font
metrics-file="file:///c:/fop/fop-0.20.4/fonts/arialnb1.xml"
kerning="yes" embed-file="c:\winnt\fonts\arialnb.ttf">
<font-triplet
name="Arial Narrow" style="normal"
weight="bold"/>
<font-triplet
name="ArialMTN" style="normal" weight="bold"/>
</font>
<font
metrics-file="file:///c:/fop/fop-0.20.4/fonts/arialni.xml"
kerning="yes" embed-file="c:\winnt\fonts\arialni.ttf">
<font-triplet
name="Arial Narrow" style="italic"
weight="normal"/>
<font-triplet
name="ArialMTN" style="italic"
weight="normal"/>
</font>
<font
metrics-file="file:///c:/fop/fop-0.20.4/fonts/arialnbi.xml"
kerning="yes" embed-file="c:\winnt\fonts\arialnbi.ttf">
<font-triplet
name="Arial Narrow" style="italic"
weight="bold"/>
<font-triplet
name="ArialMTN" style="italic" weight="bold"/>
</font>
When I used the following command line to excute:
C:\fop\fop-0.20.4>fop -c conf/userconfig1.xml
-xsl test.xsl -xml test.xml -pdf test.pdf
It works fine. However if I use FOP embedded mode
with code:
Driver driver =
new Driver();
String userConfig
= "c:/fop/fop-0.20.4/conf/userconfig.xml";
File userConfigFile
= new File(userConfig);
Options options
= new Options();
options.loadUserconfiguration(userConfigFile);
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(out);
driver.render(input.getParser(),
input.getInputSource());
I get the following errors:
[ERROR] Failed to read font
metrics file /c:/fop/fop-0.20.4/fonts/arialnb1.xml : File
"/c:/fop/fop-0.20.4/fonts/arialnb1.xml" not found.
org.apache.fop.apps.FOPException:
java.lang.NullPointerException
at org.apache.fop.apps.Driver.render(Unknown
Source)
at com.ceira.apriaups.UPSManifest.FopPrintUPS.FilerenderXML(FopPrintUPS.java:82)
at com.ceira.apriaups.UPSManifest.FopPrintUPS.ManifestReporter(FopPrintUPS.java:58)
at com.ceira.apriaups.UPSManifest.FopPrintUPS.main(FopPrintUPS.java:226)
---------
Does anyone know the work
around of this problem?
Thanks
Deborah