The API call PD4ML.useTTF(pathToFontDirs, generateFontMappingFileIfMissing) is rather a quick hack for a missing font mapping info and it is not recommended for a prod use.

It’s much better to generate the pd4fonts.properties mapping once and include it in your project.

There are various methods how to configure/include fonts. See https://pd4ml.com/pdf-fonts/.

If you’ve got a limited access to the file system, it is good idea to collect fonts to a fonts/ dir, generate pd4fonts.properties for it and to pack the fonts incl. the .properties to a JAR. Once the JAR file is deployed in your application, the fonts can be referenced using pd4ml.useTTF("java:fonts"); where “fonts” corresponds to the name of the fonts folder in the JAR file.