Reputation: 596
I have designed the reports in Jaspersoft iRreport Designer 4.0.2
In Internal preview it shows the report in specified font(calibri). Its design and alignment of elements is proper. But in PDF preview its font,alignment of elements are different.
Upvotes: 2
Views: 4322
Reputation: 22867
pdfFontName
and isPdfEmbedded
font settings. The sample:
<font fontName="Arial" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
The PDF embedded flag specifies whether an external TrueType font file should be included in the PDF file.
Font Extensions
mechanism. This method is recommended by vendor.The example:
You can generate the font extension for Calibri font with iReport. The result will be the jar file.
The config file (from the generated jar package) will be:
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="Calibri">
<normal><![CDATA[fonts/calibri.ttf]]></normal>
<bold><![CDATA[fonts/calibrib.ttf]]></bold>
<italic><![CDATA[fonts/calibrii.ttf]]></italic>
<boldItalic><![CDATA[fonts/calibriz.ttf]]></boldItalic>
<pdfEncoding><![CDATA[Identity-H]]></pdfEncoding>
<pdfEmbedded><![CDATA[true]]></pdfEmbedded>
<exportFonts>
<export key="net.sf.jasperreports.html"><![CDATA[CalibriHtml]]></export>
</exportFonts>
<locales>
<locale><![CDATA[en]]></locale>
</locales>
</fontFamily>
</fontFamilies>
The snippet from jrxml file for demonstrating the usage of a new font extension:
<staticText>
<reportElement x="215" y="26" width="100" height="20"/>
<textElement>
<font fontName="Calibri"/>
</textElement>
<text><![CDATA[Static text]]></text>
</staticText>
You can use this link for detailed information about using fonts in JasperReports.
Upvotes: 2