stanley1610 Posted April 16, 2010 Share Posted April 16, 2010 My Java standalone application calls JasperReport Viewer to show my JRML files. The application also utilizes JasperReport to export JRML to PDF.There are some text fields containing Chinese and English characters together.The exported PDF can show ALL texts correctly while the viewer cannot show them correctly. In the viewer, if the fields contain ONLY English or Chinese, the fields can display correctly; if the fields contain both, some English alphabets or Chinese characters are hidden.Why does it happen? How can I solve it? Please help Link to comment Share on other sites More sharing options...
lucianc Posted April 20, 2010 Share Posted April 20, 2010 You'll need to make sure that the font used for the text field supports both English and Chinese. Which font is it?Regards,Lucian Link to comment Share on other sites More sharing options...
stanley1610 Posted May 5, 2010 Author Share Posted May 5, 2010 After checking my other projects, it does not seem related to mixing English and Chinese. Please see the attachementsviewer_output.jpg is the result of JasperViewer, the text becomes strange characters.pdf_output.jpg is the result of PDF using JasperViewer Save As, the text looks normal. All are just English (Chinese texts have used separated fields).Here is the code tag for the text fields:<textElement><font fontName="PMingLiU" pdfFontName="MHei-Medium" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/></textElement>What did I do wrong? Please help. Link to comment Share on other sites More sharing options...
lucianc Posted May 7, 2010 Share Posted May 7, 2010 It might be that the PDF font which you are using doesn't include Latin glyphs (http://www.ascenderfonts.com/font/hei-simplified-chinese.aspx states that as only Simplified Chinese is supported). If you want to print both English and Chinese, you'll have to use a PDF font that supports both languages.Regards,Lucian Link to comment Share on other sites More sharing options...
stanley1610 Posted May 10, 2010 Author Share Posted May 10, 2010 Dear Lucian, Thanks for your reply. The problem is that the exported PDF and Excels CAN show both characters while JasperViewer CANNOT. If it was related to PDF font, it should have been that PDF cannot and JasperViewer can. Is my logic correct? Is it necessary to make both fontName and pdfFontName the same? Link to comment Share on other sites More sharing options...
lucianc Posted May 11, 2010 Share Posted May 11, 2010 My bad, I misread your message.If it's JRViewer which doesn't display English characters, the likely cause is that the font set as fontName (which is used in the viewer) doesn't include Latin glyphs.And yes, you should be using the same font for PDF and AWT. See the "Why is my text not displayed correctly in PDF?" FAQ at http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/faq.html?group_id=102#FAQ25 for an explanation on this.Regards,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now