My Java application generates a pdf file filling a JasperReports's report, but when i open the pdf file the fonts it's allways "Arial", in report is set to "DejaVu Sans".
When I use the JasperReports functions to export to pdf file everything works good (after that i've imported the .ttf file of DejaVu Sans). The problem persists only when I use the Java application.
Here is the start of one of my subreports.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="sub_21" pageWidth="515" pageHeight="842" columnWidth="515" leftMargin="0" rightMargin="0" topMargin="30" bottomMargin="0" uuid="34ff3034-41c3-4268-b500-7252cbe01a14">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<parameter name="acp" class="acp.pdfengine.entities.PdfData"/>
<detail>
<band height="376" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="0" width="181" height="21" isRemoveLineWhenBlank="true" uuid="7b1fe94a-28dd-42d1-b6db-ee2dcc2d7020"/>
<textElement>
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{acp}.getPdfWords().getRESULT_title()]]></textFieldExpression>
</textField>
And here is the piece of java code that fills the reports and creates the pdf:
filledReport = JasperFillManager.fillReport(report, params, dataSource);
JasperExportManager.exportReportToPdfFile(filledReport, data.getPdfInfo().getResourcesPath() + data.getPdfInfo().getFileName());
Here is my jasperreports-fonts.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="DejaVu Sans" visible="true">
<normal>net/sf/jasperreports/fonts/dejavu/DejaVuSans.ttf</normal>
<bold>net/sf/jasperreports/fonts/dejavu/DejaVuSans-Bold.ttf</bold>
<italic>net/sf/jasperreports/fonts/dejavu/DejaVuSans-Oblique.ttf</italic>
<boldItalic>net/sf/jasperreports/fonts/dejavu/DejaVuSans-BoldOblique.ttf</boldItalic>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
<exportFonts>
<export key="net.sf.jasperreports.html">'DejaVu Sans', Arial, Helvetica, sans-serif</export>
<export key="net.sf.jasperreports.xhtml">'DejaVu Sans', Arial, Helvetica, sans-serif</export>
</exportFonts>
</fontFamily>
<fontFamily name="Pictonic" visible="false">
<normal>
<ttf>net/sf/jasperreports/fonts/pictonic/pictonic.ttf</ttf>
<svg>net/sf/jasperreports/fonts/pictonic/pictonic.svg</svg>
<eot>net/sf/jasperreports/fonts/pictonic/pictonic.eot</eot>
<woff>net/sf/jasperreports/fonts/pictonic/pictonic.woff</woff>
</normal>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
</fontFamily>
</fontFamilies>
Does anyone have the same problem?
@Erald See this example of Spring Boot with Reports in Jasper, in the pom there are jasperreports dependecies. https://github.com/karelp90/control_asp