Skip to content

Jasper: Font extensions

To support various fonts in PDFs the fonts need to be loaded using a custom classloader. The current thread's classloader needs to be saved:

final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {

 .. do things with a custom classloader

} finally {
 Thread.currentThread().setContextClassLoader(contextClassLoader);
}

The fonts can be exported as jar by users and uploaded to file repository (e.g. /fonts folder ?) to be embedded in PDF. This requires a net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory

Note: for the moment I updated Docker to include MS core fonts (Arial). That needs to be removed when font extensions are working.

Edited by Matija Obreza
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information