PdfGlyphRenderer exception

Anytime I try to export a report to PDF I get this exception.

Could not initialize class net.sf.jasperreports.engine.export.PdfGlyphRenderer

Any idea, what is causing this and how to fix this?

Btw: I've tried JasperExportManager.exportReportToPdfFile, JasperExportManager.exportReportToPdfStream methods and also creating a JRPdfExporter settings input and output and then calling the exportReport method. I get the same exception all the time.

sskotnicky's picture
Joined: Aug 23 2018 - 7:03am
Last seen: 10 months 4 weeks ago

3 Answers:

I have never seen this error before, could you post more exception text? Have you tried to add -Djava.awt.headless=true to your JAVA_OPTS?

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 2 months 3 weeks ago

Are you using JasperReports IO as you've tagged your question or are you actually writing your own program using JasperReports library. If the later, check that you haven't specified itext dependency beside the one jasperreports comes bundled with.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 7 months ago

Thank you very much for the reply.
I am writing a method that gets the JasperReport and exports it to HTML / PDF, because the preview generated has some problems with the arabic font . Export to PDF throws this exception and export to HTML work almost OK. It generates the HTML correctly, but when I print it (or export to PDF), co covers only (around) 80% of page. (I can give you more details if you want).

Here is the whole stact trace:
2019-04-08 09:13:38.130    23 LogTopic.Desktop.DESKTOP ERROR   Uncaught exception {EXCEPTION}
java.lang.NoClassDefFoundError: com/lowagie/text/pdf/PdfContentByte
    at net.sf.jasperreports.engine.export.PdfGlyphRenderer.determinePatchedItext(PdfGlyphRenderer.java:59)
    at net.sf.jasperreports.engine.export.PdfGlyphRenderer.<clinit>(PdfGlyphRenderer.java:52)
    at net.sf.jasperreports.engine.export.JRPdfExporter.initExport(JRPdfExporter.java:580)
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:539)
    at net.sf.jasperreports.engine.JasperExportManager.exportToPdfFile(JasperExportManager.java:155)
    at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:503)
    at octopus.client.print.PrintPreviewDialog.generatePreview(PrintPreviewDialog.java:520)

sskotnicky's picture
Joined: Aug 23 2018 - 7:03am
Last seen: 10 months 4 weeks ago