Try the following:
byte[] bytes = IOUtils.toByteArray(Thread.currentThread().getContextClassLoader() .getResourceAsStream("/resources/arial.ttf")); BaseFont.createFont("arial.ttf", BaseFont.IDENTITY_Harial.ttf, BaseFont.EMBEDDED, true, bytes, null);
You must specify .ttf in the font name to tell the method that it should interpret it as a ttf format.
source share