Hi, just saw that my whole report (one main and eleven subreports) are not bold in any of my text-fields. I am required to use Arial if possible, but since Arial seems not to get used when exporting to pdf and font weight seems to get discarded if that happens, I switched to Sans Serif.
Is there any way to use Arial font with bold font weight when exporting to pdf without workarounds? Just a clean solution? If not I'd be very thankful for any explanation on why it is that way as I need to justify my descisions and it'd help me a lot ^_^
I have the same problem. I've created extensions for Arial Bold, Arial Italic and Arial Bold Italic, using the corresponding WIndows font files. They show up as expected in the Font dropdown. I then exported them to a jar. I looked in the jar file and everything looks good. The fontsfamily.xml file contains:
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="Arial-Italic">
<italic>fonts/Arial_Italic/ariali.ttf</italic>
<pdfEncoding>Cp1252</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
<exportFonts>
</exportFonts>
</fontFamily>
<fontFamily name="Arial-Bold">
<bold>fonts/Arial_Bold/arialbd.ttf</bold>
<pdfEncoding>Cp1252</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
<exportFonts>
</exportFonts>
</fontFamily>
<fontFamily name="Arial-Bold-Italic">
<boldItalic>fonts/Arial_Bold_Italic/arialbi.ttf</boldItalic>
<pdfEncoding>Cp1252</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
<exportFonts>
</exportFonts>
</fontFamily>
</fontFamilies>
In my case I'm using it in a web app, so it's with the rest of my jars in WEB-INF/lib. For a fixed text element which I want in Arial Italic, I selected "styled" in the markup dropdown, and added a <style> element to the text:
<staticText>
<reportElement style="Large" x="30" y="40" width="126" height="30" uuid="7e908695-0594-4452-9a82-471ef38d7281">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement markup="styled"/>
<text><![CDATA[<style pdfFontName="Arial-Italic" isPdfEmbedded="true">Public Security Division</style>]]></text>
</staticText>
But when I try to generate the PDF in my web app, I get an exception:
net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font:
pdfFontName: Arial-Italic
pdfEncoding: Cp1252
isPdfEmbedded : true
at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2278)
at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:2069)
....
I'm at a loss. Any ideas?
- Log in or register to post comments
add comment