java.io.FileNotFoundException when using a ttf font file in JBoss EAP

Solution Verified - Updated -

Issue

A ttf font was installed on the operating system, but when trying to generate a pdf report by an application, the following error is generated:

05-06-2019 10:52:35,533 ERROR [com.itextpdf.html2pdf.css.parse.CssRuleSetParser] (default task-25) Invalid css property declaration: url('/usr/share/fonts/futura/FuturaStd-Book) format('truetype')
05-06-2019 10:52:35,543 ERROR [com.itextpdf.html2pdf.resolver.resource.ResourceResolver] (default task-25) Unable to retrieve stream with given base URI (file:/opt/jboss/jboss-eap-7.0/) and source path (/usr/share/fonts/futura/FuturaStd-Book.ttf): java.io.FileNotFoundException: /opt/jboss/jboss-eap-7.0/usr/share/fonts/futura/FuturaStd-Book.ttf (No such file or directory)
        at java.io.FileInputStream.open0(Native Method) [rt.jar:1.8.0_172]
        at java.io.FileInputStream.open(FileInputStream.java:195) [rt.jar:1.8.0_172]
        at java.io.FileInputStream.<init>(FileInputStream.java:138) [rt.jar:1.8.0_172]
        at java.io.FileInputStream.<init>(FileInputStream.java:93) [rt.jar:1.8.0_172]
(...)
05-06-2019 10:52:35,571 ERROR [com.itextpdf.html2pdf.attach.impl.DefaultHtmlProcessor] (default task-25) Unable to retrieve font:
 @font-face {
    font-family: 'FuturaStd-Book'
    src: local(futurastd-book),url('/usr/share/fonts/futura/FuturaStd-Book.ttf') format('truetype')
}
05-06-2019 10:52:35,896 WARN  [com.itextpdf.html2pdf.css.resolve.DefaultCssResolver] (default task-25) Invalid css property declaration: color: rgb (76,84,109)

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In