我在windows中使用eclipse。
使用 jar jasperreports-4.1.1.jar 从 jrxml 文件生成 pdf 文件时出现此错误。我已经从我的 windows 文件夹中手动将字体文件添加到我的 jre 中,并将字体路径添加到路径变量,但仍然出现相同的错误。
net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font :
pdfFontName : Arial
pdfEncoding : Cp1252
isPdfEmbedded : false
我观察到的另一件奇怪的事情是,当我为 Cambria 字体尝试相同的功能时,我得到了一个不同的错误。以下是我使用 cambria 时的错误
net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'CAMBRIA' is not available to the JVM. See the Javadoc for more details.
at net.sf.jasperreports.engine.util.JRFontUtil.checkAwtFont(JRFontUtil.java:358)
at net.sf.jasperreports.engine.util.JRStyledText.getAwtAttributedString(JRStyledText.java:226)
at net.sf.jasperreports.engine.export.AbstractTextRenderer.render(AbstractTextRenderer.java:263)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2026)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:729)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportFrame(JRPdfExporter.java:2526)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:733)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportFrame(JRPdfExporter.java:2526)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:733)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:689)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:582)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:376)
at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:122)
at main.CopyOfTable.runReport(CopyOfTable.java:60)
at main.CopyOfTable.main(CopyOfTable.java:100)