Jump to content

Recommended Posts

Posted

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 exception

net.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 follows

net.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

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Posted

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.

  • 4 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...