How to use gujrati font In jasper Report with Java

I have installed shrti.ttl in iReport Tool and export extenstion as Jar of this to use this In java code.

Its properly display content in iReport, but when I exportReportToPdf in java code ...its properly not displaying content

some two three words are displaying not properly

in Java simple code look like 

JRBeanCollectionDataSource ds=new JRBeanCollectionDataSource(beanData);
jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds);

JasperExportManager.exportReportToPdf(jasperPrint);

 

and Ireport xml file simple code like

 

<staticText>
                <reportElement x="72" y="530" width="571" height="185" uuid="74ab227f-bb7b-4ca2-9b00-acd0dfd74ad6"/>
                <textElement>
                    <font fontName="Shruti" size="12" isBold="false" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[ર્પાછળ વાળી જગ્યામાં

 પ્રધાનમંત્રી   દ્રારા ભરપાઇ કરવામાં આવેલ હોય

 આથી સોપવામાં આવે છે.]]></text>
            </staticText>

 

also ref

lotiyahardik's picture
Joined: Sep 20 2017 - 7:17pm
Last seen: 5 years 5 days ago

2 Answers:

iReport has some problem with external fonts. Try using JasperSoft Studio.

hozawa's picture
148374
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 3 months ago

I found the same issue gujrati font not accept with the jaspersoft studio.

I set the data using the <textFieldExpression>. and while I generate the pdf I get null data in pdf report.

If you get the solution then please give a guidance. 

Below is my title band code.
 

<band height="93" splitType="Stretch">
            <staticText>
                <reportElement x="140" y="11" width="209" height="22" uuid="755bb5bb-6839-4804-a518-4f8cf300bd6b"/>
                <textElement textAlignment="Center">
                    <font fontName="Noto Sans" size="15" isBold="true" isUnderline="true"/>
                </textElement>
                <text><![CDATA[રેવેન્યુ સરવે ]]></text>
            </staticText>
            <textField>
                <reportElement stretchType="RelativeToBandHeight" x="300" y="70" width="220" height="23" forecolor="#000000" uuid="c865ac91-0388-4fa0-9612-64b27f22184c"/>
                <textElement>
                    <font fontName="Noto Sans" size="12" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{surveyno}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement stretchType="RelativeToBandHeight" x="300" y="41" width="220" height="23" forecolor="#000000" uuid="46999d55-2851-4b42-b160-556e688726d5"/>
                <textElement>
                    <font fontName="Noto Sans" size="12" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{taluka}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement stretchType="RelativeToBandHeight" x="370" y="8" width="154" height="23" forecolor="#000000" uuid="99475b0d-1ae2-4288-8bec-6747665e37da"/>
                <textElement textAlignment="Right">
                    <font fontName="Noto Sans" size="11" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{date}]]></textFieldExpression>
            </textField>
            <image>
                <reportElement x="9" y="20" width="60" height="59" uuid="de9dcacb-67cd-4a16-84dd-37e34a9c0c2a"/>
                <imageExpression><![CDATA[$P{_SYMBOL}]]></imageExpression>
            </image>
            <textField>
                <reportElement stretchType="RelativeToBandHeight" x="80" y="70" width="210" height="22" forecolor="#000000" uuid="564b3bb4-cb4b-43f2-be4b-8512b5d47d4c"/>
                <textElement>
                    <font fontName="Noto Sans" size="12" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{village}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement stretchType="RelativeToBandHeight" x="80" y="42" width="210" height="21" uuid="20527167-596c-4574-90a4-fc9671c135a7"/>
                <textElement>
                    <font fontName="Noto Sans" size="12" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{district}]]></textFieldExpression>
            </textField>
        </band>

bansri.gor007's picture
Joined: Oct 28 2021 - 10:27pm
Last seen: 10 months 1 week ago
Feedback
randomness