I have a problem that Helvetica, which I am not using in any of my JRXML fields, is being used as the default font in Jasper PDF reports.
I am using iReports 4.0.2.
I have a problem that Helvetica, which I am not using in any of my JRXML fields, is being used as the default font in Jasper PDF reports.
I am using iReports 4.0.2.
net.sf.jasperreports.default.font.name
and/or net.sf.jasperreports.default.pdf.font.name
properties.For example, it were my defaults settings in iReport (dialog Options -> JasperReports Properties):
With this settings (without setting default style in the template) I have the Helvetica font in my pdf generated by iReport.
After that I've changed settings in iReport like this:
And now I have Courier font in my pdf file (generated by iReport):
With JasperReports API you can set this properties with help of JRProperties.setProperty(java.lang.String key, boolean value) method.
The sample:
JRProperties.setProperty("net.sf.jasperreports.default.pdf.font.name", defaultPDFFont);
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params);
JasperExportManager.exportReportToPdfFile(jasperPrint, outputFileName);
The example:
<jasperReport .. topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Base" isDefault="true" hAlign="Center" vAlign="Middle" fontSize="10" pdfFontName="Courier" pdfEncoding="UTF8" isPdfEmbedded="false"/>
<queryString>
More information about working with fonts you can read here.
I use NetBeans and on one of my projects i wanted to use Garamond as my default font for my pdfs so what i did was:
Run report, save it, then view it.