I need your help in adding a custom font "arial.ttf" which is stored under the resources folder in my project in the FontFactory.register method in iText.
The font path is as follows in the project from Windows Explorer:
public_html\resources\fonts\arial.ttf
The code for referring to the font is:
FontFactory.register("/resources/fonts/arial.ttf", "my_bold_font");
Font myBoldFont = FontFactory.getFont("my_bold_font");
However when I ran the Java method, it always gives me the error:
java.io.IOException: /resources/fonts/arial.ttf not found as file or resource.
I tried with different paths for example:
/public_html/resources/fonts/arial.ttf
../resources/fonts/arial.ttf
/fonts/arial.ttf
/arial.ttf
But the result is the same that the file can't be found. So how to refer to the file?