Embedding font using fop.xconf
- Code: Select all
<base>./</base>
<font metrics-url="servlet-context:/fonts/DejaVuSerif-Bold.xml" embed-url="servlet-context:/WEB-INF/fonts/DejaVuSerif-Bold.ttf" kerning="yes">
<font-triplet name="DejaVuSerif-Bold" style="normal" weight="normal" />
</font>
and setting through api
- Code: Select all
FOSettings foSettings = Docx4J.createFOSettings();
foSettings.setWmlPackage(wordMLPackage);
ClassPathResource cpr = new ClassPathResource("fop.conf");
InputStream inputStream = cpr.getInputStream();
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer, "UTF-8");
String conf = writer.toString();
yields following exception:
Exception setting up result for fo transformation: Failed to resolve font with embed-url 'servlet-context:/WEB-INF/fonts/DejaVuSerif-Bold.ttf'.
Is there a way I can set user agent through fosettings or any other parameters I need to set in config(fop), so that fonts need to embedded on pdf picked up from context path?
Using Fop(1.1)
Thanks.