I need your help in referring to a font file which is called "arial.ttf" which is placed under the below path:
resources/fonts/arial.ttf
in my Java web application. The application is built in JSF. I am using iText to generate the PDF files and in the Java classed I am using the below code to state the font:
BaseFont bf = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf", BaseFont.IDENTITY_H, true);
This is working fine in my local environment, however, now I want to deploy the application and I need to remove the reference to my local drive c:/, therefore, followed how JSF is referring to an image or any file which is:
<h:graphicImage value="/resources/images/XX_XX.gif" />
And I changed the path to:
BaseFont bf = BaseFont.createFont("/resources/fonts/arial.ttf", BaseFont.IDENTITY_H, true);
But, unfortunately I got the below error:
java.io.IOException: resources/fonts/arial.ttf not found as file or resource.
Then also I tried to changed the path to :
BaseFont bf = BaseFont.createFont("\\resources\\fonts\\arial.ttf", BaseFont.IDENTITY_H, true);
But still it didn't get the file. So how can I refer to it.