Jump to content
We've recently updated our Privacy Statement, available here ×

report in PDF italic font problem


bogdangh

Recommended Posts

Hi. I have a report that has some data written in italic font. In XLS works fine, but in PDF the italic font style doesnt work. I have jasperreports 1.2.3. The thing is that until I upgrated to this version, it worked ok in PDF also. Maybe it is a bug in the new version or maybe i didnt noticed before that the style wasnt italic.

 

Here is the code:

<staticText>

<reportElement positionType="Float" x="0" y="1" width="300" height="17" isPrintWhenDetailOverflows="true">

<printWhenExpression><![CDATA[new Boolean($F{ROW_TYPE}.equals("GRAND_TOTAL_ROW"))]]></printWhenExpression>

</reportElement>

<textElement verticalAlignment="Middle" isStyledText="true">

<font fontName="SansSerif" isBold="true" isItalic="true" isUnderline="true"/>

</textElement>

<text><![CDATA[ Grand total]]></text>

</staticText>

 

The text is only underlined, bold and italic doesnt seem to work. Am I doing something wrong ?

 

Bogdan

Link to comment
Share on other sites

Hi,

 

You need to use the pdfFontName attribute to point to a corresponding PDF built-in font or TTF file that would have the italic properties.

Take a look at our /demo/samples/fonts sample provided in the project distribution.

Another approach would be to use the recently added support for font mapping at export time (the FONT_MAP exporter parameter). Same sample would be relevant in this case too.

 

I don't know what version of JR you were using previously, but in the early days we used to simulate italic fonts usint iText, by default. This behavior could now be turned on only using the font mapping functionality of the PDF exporter.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

  • 5 years later...

Hi,

I am facing a similar problem, but with Arabic text. Using iReport 3.0.0, While the non-italicized arabic text displays correctly with iReport font as "Sans Serif" and PDF font as arial with "Unicode with Horizontal Writing" as the PDF encoding, When I make it italic, the text is not displayed. (For italic text I tried with both arial.ttf and ArialI.ttf).

Using the latest iReport 4.0.2 also, I am facing the same problem. Here, I am using the PDF font as Helvetica-Oblique and encoding as CP1252, however, for non-italicized, it displayes the text, for italic text, it does not.

I tried with the "Fonts" and "unicode" demo, but whenever I made the text italic, it stops to be displayed.

However, for hebrew text, strangly there is no problem with italicized text.

Please help.

Link to comment
Share on other sites

  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...