Skip to Content
0
Former Member
May 13, 2015 at 12:02 PM

FOP configuration - path to custom fonts

768 Views

Hi all,

I am using FOP to generate a PDF file. I need to use some custom fonts, so I followed this guide to tell FOP where on the disk to find them.

The guide works perfectly on a standalone FOP instance, while I am not able to replicate the same behavior on the Hybris embedded version, due to a problem with relative paths. It seems that no matter what I configure, I am not able to reach my fonts using a relative path, either to the Hybris bin dir, the fop configuration file dir, the fop lib dir, etc...

The Apache guide says:

Relative URIs for those properties are evaluated relative to the base URI of the configuration file. If the configuration is provided programmatically, the base URI can be set with FopFactory.setUserConfigBaseURI ; default is the current working directory.

I tried different configurations for the fopconfig.xml file; I also tried to customize the fop.config.xml property inside project.properties, with no luck.

The only working configuration is the following:

 <fop version="1.0">
   <strict-validation>false</strict-validation>
   <renderers>
     <renderer mime="application/pdf">
       <fonts>
         <directory>ABSOLUTE_PATH_TO_MY_HYBRIS_BIN_DIR/platform/ext/commons/resources/commons/config/fonts/</directory>
         <autodetect/>
       </fonts>
     </renderer>
   </renderers>
 </fop>

But of course I don't want to use an absolute path.

Could someone help me?

Thank you Francesco