iamrakesh22 Posted April 14, 2015 Posted April 14, 2015 Hi,I am using Jasper reports library version 5.0.1, and I am trying to export report to PDF. I've configuration to use 'Noto Sans' as default font and 'net.sf.jasperreports.default.pdf.embedded' set to true. 'Noto Sans' font files are added to classpath as part of Font extension.But when I try to export my report to PDF, I get the below given exceptionnet.sf.jasperreports.engine.JRRuntimeException: Could not load the following font :pdfFontName : Noto SanspdfEncoding : Cp1252isPdfEmbedded : true at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2042) at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:1805) at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:1774) at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.getPhrase(SimplePdfTextRenderer.java:89) at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.render(SimplePdfTextRenderer.java:99) at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2164) at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:858) at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:818) at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:695) at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:396)[/code]my font extension configuration is as followsnet.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactorynet.sf.jasperreports.extension.simple.font.families.ireportfamily=font-families.xml[/code]<?xml version="1.0" encoding="UTF-8"?><fontFamilies> <fontFamily name="Noto Sans"> <normal><![CDATA[fonts/noto/NotoSans-Regular.ttf]]></normal> <bold><![CDATA[fonts/noto/NotoSans-Bold.ttf]]></bold> <italic><![CDATA[fonts/noto/NotoSans-Italic.ttf]]></italic> <boldItalic><![CDATA[fonts/noto/NotoSans-BoldItalic.ttf]]></boldItalic> <pdfEmbedded><![CDATA[true]]></pdfEmbedded> <exportFonts> <export key="net.sf.jasperreports.rtf"><![CDATA["Noto Sans", Arial, Helvetica, sans-serif]]></export> <export key="net.sf.jasperreports.xhtml"><![CDATA["Noto Sans", Arial, Helvetica, sans-serif]]></export> <export key="net.sf.jasperreports.html"><![CDATA["Noto Sans", Arial, Helvetica, sans-serif]]></export> </exportFonts> </fontFamily></fontFamilies>[/code]can you please point out what could be the reason for the above exception?Regards,Rakesh.A
AnnMary.Thomas Posted April 14, 2015 Posted April 14, 2015 Did you add the .ttf (font files) files to your application. Please check the below linkhttp://www.codesuggestions.com/java/jasper-reports/adding-custom-fonts-to-jasper-reports/
iamrakesh22 Posted April 15, 2015 Author Posted April 15, 2015 I am not able to reply to the answer posted by Thomas below, hence this comment. @Thomas - Yes, if you see the fonts-families.xml, I posted above, all the .ttf files are in correct directories and the JAR is in classpath.
iamrakesh22 Posted April 16, 2015 Author Posted April 16, 2015 Yes, if you see the fonts-families.xml, I posted above, all the .ttf files are in font extension JAR and it is in classpath.
apostolos.apostolakidis Posted September 9, 2019 Posted September 9, 2019 Hi @iamrakesh22I am having the exact same issue. Were you able to resolve the exception?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now