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