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

Incorrect Text Display in Viewer


stanley1610

Recommended Posts

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

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

After checking my other projects, it does not seem related to mixing English and Chinese.

 

Please see the attachements

viewer_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

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

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

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