0

Jasperreport .pdf no Styles (Bold, Italics, etc.)

asked 2010-05-12 10:21:09 +0800

jasonphos gravatar image jasonphos
66 1 1 1

Hi everyone,

I am working on an inherited project where we are using a ZK jasperreport object to print a jasper report.

For some reason, no style formatting like Bold or Italics is displayed in the outputted report. The report is outputted as .pdf. I don't see ".pdf" anywhere in the code, so I'm guessing that must be the default for a ZK jasperreport object.

If I run the report in iReport as a .pdf, the styles are displayed.
I can't for the life of me figure out what is wrong or how to fix this. I've spent the last 2 days pouring over this.

At this point, I'm planning to start over from scratch and see if I can get bold and italics to work with a separate, test project. In any case, I wanted to ask if anyone else has seen this problem, or has it working? I know that the problem is either:

- The font.jar that we are using. We are using one titled "xxx_winfonts.jar" which contains Arial, Courier, and a handful of other fonts. Even so, I can't figure out what font our reports are using, because they don't seem to specify the font anywhere. Therefore, it must be the default font, I figure... I also tried replacing this with the xxx_fonts.jar that iReports is using, but it had no effect.
- Something else, no clue what :)

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2010-05-13 11:51:12 +0800

Arsen gravatar image Arsen
381 2

Hi, jasonphos. I had some problems with pdf fonts, and I solved them using jasper report font extensions. If you had no style formatting, then I guess there could be two possible reasons:
* Your reports are written using deprecated property "Pdf font name" and fonts.jar is not font extension but just a resource. You can check this using iReport. The soultion is to use font extentions.
* Fonts.jar is font extension, but you report is using unregisreted fonts. So change fonts of report components or add new font to extension.

link publish delete flag offensive edit

answered 2010-05-13 13:46:02 +0800

jasonphos gravatar image jasonphos
66 1 1 1

Hey Arsen,
Ok. I will think about this and try to figure out what you mean about using unregistered fonts. Thank you for the answer. I probably won't get to this today, but I'll probably get to it tomorrow or Monday at the latest.

Right now, as far as I can tell, we aren't specifying any fonts. For instance, here is a sample report (I deleted all of the report parameters and most of the fields, so this particular report may not run, but it should give you an idea how are reports are formatted):

<?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="Fax" pageWidth="581" pageHeight="743" columnWidth="581" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="com.jasperassistant.designer.Grid" value="false"/>
<property name="com.jasperassistant.designer.SnapToGrid" value="false"/>
<property name="com.jasperassistant.designer.GridWidth" value="12"/>
<property name="com.jasperassistant.designer.GridHeight" value="12"/>
<property name="com.jasperassistant.designer.DataSource" value="Note Orderpart Provider"/>
<property name="com.jasperassistant.designer.Units" value="Centimeters"/>
<property name="com.jasperassistant.designer.Locale" value="en_US"/>
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<detail>
<band height="703">
<staticText>
<reportElement x="16" y="0" width="551" height="15"/>
<textElement textAlignment="Center">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Services: Form]]></text>
</staticText>
<staticText>
<reportElement x="17" y="18" width="40" height="13"/>
<box leftPadding="2">
<pen lineWidth="0.25" lineStyle="Solid"/>
</box>
<textElement/>
<text><![CDATA[Name:]]></text>
</staticText>
<textField>
<reportElement mode="Opaque" x="57" y="18" width="224" height="13" backcolor="#F1F1F1"/>
<box leftPadding="2">
<pen lineWidth="0.25" lineStyle="Solid"/>
</box>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$P{TE_1002}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement mode="Transparent" x="9" y="15" width="281" height="123"/>
</rectangle>
<rectangle>
<reportElement mode="Transparent" x="290" y="15" width="281" height="123"/>
</rectangle>
<staticText>
<reportElement x="17" y="31" width="40" height="13"/>
<box leftPadding="2">
<pen lineWidth="0.25" lineStyle="Solid"/>
</box>
<textElement/>
<text><![CDATA[SSN:]]></text>
</staticText>
</band>
</detail>
</jasperReport>

link publish delete flag offensive edit

answered 2010-08-31 04:23:18 +0800

xmedeko gravatar image xmedeko
1021 1 16
http://xmedeko.blogspot.c...

Hi Jason,
I had the same problem, check my solution http://sites.google.com/site/xmedeko/code/misc/jasperreports-pdf-font-mapping

link publish delete flag offensive edit

answered 2010-08-31 09:34:16 +0800

jasonphos gravatar image jasonphos
66 1 1 1

Hey xmedeko - Thanks for thinking about me!

In any case, I did solve the problem.

It ends up that in our case, the problem was solved by specifying a font within the report, as opposed to using a default font.

You see, we already had a "jasperreports-fonts-xxx.jar", and it still wasn't working. The reason it wasn't working was because we didn't specify a font for each field in the report.

However, when I specified a font (i.e. Arial) for each field in the report, and I made sure to choose a font that exists in the fonts.jar file (i.e. Arial exists), then at that point everything started working.

link publish delete flag offensive edit

answered 2014-11-16 19:27:49 +0800

fedesacaba gravatar image fedesacaba
1

hi everyone, I have this problem when running the jasper Caused by: net.sf.jasperreports.engine.util.JRFontNotFoundException: Font ' net/sf/jasperreports/fonts/pictonic/pictonic.ttf net/sf/jasperreports/fonts/pictonic/pictonic.svg net/sf/jasperreports/fonts/pictonic/pictonic.eot net/sf/jasperreports/fonts/pictonic/pictonic.woff ' is not available to the JVM. See the Javadoc for more details.

someone can help me

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-05-12 10:21:09 +0800

Seen: 5,783 times

Last updated: Nov 16 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More