如何在Jasperreport Maven依赖项中更改默认字体以支持中文字符?

时间:2018-12-12 10:05:47

标签: fonts jasper-reports pdf-generation multibyte-characters

我试图在Java Web应用程序的jasperstudio生成的pdf文件中使用Arial Unicode MS。但是,出现此错误:

net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font: 
pdfFontName: Arial Unicode MS
pdfEncoding: Identity-H
isPdfEmbedded : false

这是我的jasperreports_extenstions.properties中的内容:

net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory
    net.sf.jasperreports.extension.fonts.spring.beans.resource=fonts/fonts1284146005640.xml

但是,当我在Java应用程序中查看jasperreports jar文件时,可以在jasperreports-fonts.xml文件中找到它:

<?xml version="1.0" encoding="UTF-8"?>

<fontFamilies>

    <fontFamily name="JasperReports Icons" visible="false">
        <normal>
            <ttf>net/sf/jasperreports/fonts/icons/icons.ttf</ttf>
            <svg>net/sf/jasperreports/fonts/icons/icons.svg</svg>
            <eot>net/sf/jasperreports/fonts/icons/icons.eot</eot>
            <woff>net/sf/jasperreports/fonts/icons/icons.woff</woff>
        </normal>
        <pdfEncoding>Identity-H</pdfEncoding>
        <pdfEmbedded>true</pdfEmbedded>
    </fontFamily>

    <!-- 
        Deprecated and no longer used. Kept for backward compatibility with persisted
        generated reports in JasperPrint or JRPXML format.
    -->
    <fontFamily name="Pictonic" visible="false">
        <normal>
            <ttf>net/sf/jasperreports/fonts/icons/icons.ttf</ttf>
            <svg>net/sf/jasperreports/fonts/icons/icons.svg</svg>
            <eot>net/sf/jasperreports/fonts/icons/icons.eot</eot>
            <woff>net/sf/jasperreports/fonts/icons/icons.woff</woff>
        </normal>
        <pdfEncoding>Identity-H</pdfEncoding>
        <pdfEmbedded>true</pdfEmbedded>
    </fontFamily>

</fontFamilies>

我感觉它正在寻找Arial字体,但找不到它,我该如何解决?

0 个答案:

没有答案