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

Character Encoding Solution (For pdf)


Recommended Posts

By: Hakan ERDOGAN - hakan008

Character Encoding Solution (For pdf)

2003-07-28 10:16

Hi all, I read a lot of messages including character encoding problem while writing to pdf. Here is a solution (Based on Turkish Characters):

XML File:

<?xml version="1.0" encoding="ISO-8859-9"?>

 

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="CharacterEncodingTest"

columnCount="1"

printOrder="Vertical"

orientation="Landscape"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="AllSectionsNoDetail"

isTitleNewPage="false"

isSummaryNewPage="false">

 

<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="8" pdfEncoding="Cp1254" isPdfEmbedded="false"/>

 

<title>

<band height="70">

<staticText>

<reportElement mode="Opaque" x="12" y="9" width="513" height="34" forecolor="#33FF33" backcolor="#000000" positionType="FixRelativeToTop"/>

<textElement textAlignment="Center" verticalAlignment="Middle" lineSpacing="Single">

<font size="16" isBold="true" isItalic="false" isUnderline="false"/>

</textElement>

<text><![CDATA[sample Turkish Characters : Ǭ İ, Ğ, Ö¬ Ş, ܬ ç¬ı, ğ,   amp;#351;,   gt;</text>

</staticText>

</band>

</title>

 

<pageHeader><band height="50"></band>

</pageHeader>

<columnHeader><band height="30"></band>

</columnHeader>

<detail><band height="100"></band>

</detail>

<columnFooter><band height="30"></band>

</columnFooter>

<pageFooter><band height="50"></band>

</pageFooter>

<summary><band height="50"></band>

</summary>

 

</jasperReport>

 

There are 3 important points:

1. <?xml version="1.0" encoding="ISO-8859-9"?> (Change encoding as your language's)

2. whenNoDataType="AllSectionsNoDetail" (This is necessary for this example)

3. <reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="8" pdfEncoding="Cp1254" isPdfEmbedded="false"/>

(Change pdfEncoding as your language's)

 

It is now OK.

Byees

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...