How to print Chinese characters in PDF?

0

Hi ,

I created a report which generates chinese characters also,my code is

<font fontName="Arial Unicode MS" size="8" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[($F{PCONA_ADDR1}!=null ? $F{PCONA_ADDR1} +"<br>": "") + ($F{PCONA_ADDR2}!=null ? $F{PCONA_ADDR2} +"<br>": "") +
($F{PCONA_ADDR3}!=null ? $F{PCONA_ADDR3}:"")]]></textFieldExpression>
            </textField>

 

It is working fine in ireport internal preview when i export it has PDF format it is not working it is printing like "?????????" instead of chinese characters 

how to print chinese charcters and other charcters in PDF.

 

Thanks in advance

Selva 

 

selvakumar.1405130's picture
Joined: Apr 12 2019 - 12:00am
Last seen: 2 months 4 days ago

1 Answer:

0

I guess you will have to build a font-extension for your Arial-Unicode font and set the pdf-encoding to IDENTITY-H and not to Cp1250 (what is central european... a bit far away from our chinese friends!??! :-) )

Also I'd advice not to adjust the pdf-encoding stuff at each single TextElement level but instead on a default-style report level... otherwise the report is heavy to maintain later.

The font-extension must be within the classpath or your java-application (if you export reports from that and not only from designer)

just see the JasperReports Docus e.g.: https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-user-guide/v640/working-font-extensions

hth + regards

C-Box

C-Box's picture
2154
Joined: Jul 19 2006 - 5:58pm
Last seen: 12 hours 41 min ago
Feedback