I am trying to use a font that is not installed on my local OS with JasperReports . The jasper report is used as follows:
<textField> <reportElement x="0" y="0" width="137" height="20"/> <textElement> <font fontName="Corbel" size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{something}]]></textFieldExpression> </textField>
A font named Corbel was exported as a font extension (using iReport) and is contained in a file (Corbel.jar) in a folder on my system. I am adding this extension to the application class path using the following code:
ClassLoader cl = new URLClassLoader(new URL[] {new URL("file:///D:/path/to/Corbel_jar_folder/")}); param = new HashMap(); param.put(JRParameter.REPORT_CLASS_LOADER, cl); jasperReport = JasperCompileManager.compileReport("d:/path/to/Report_with_Corbel_font.jrxml"); jasperPrint = JasperFillManager.fillReport(jasperReport, param, new JREmptyDataSource());
After filling out the report, I export it using JRPdfExporter . However, in the result pdf file, the element does not have the Corbel font applied. I did not include pdf export because I think the problem is somewhere with filling. I searched and read numerous posts and questions related to using / including fonts (i.eont extensions) in JasperReports ; yet I donβt know where the error or problem is. Any help would be greatly appreciated.
Thank you in advance! (sorry for the indentation in the bad code, and I hope I have included enough details)
source share