Jump to content
  • JasperReport saved in PDF format on Chinese OS failed to open

    Assigned User shertage
    CategoryBug report

    our application use JasperReport function to create pdf format cannot be opened by Acrobat Reader.

    With Chinese version Windows XP but use different language and locale in control panel. This matrix is the result:


    Local Language Result


    USA English OK but Chinese char can't be displayed…


    USA Chinese Fail to open


    TW English OK but Chinese char can't be displayed…


    TW Chinese Fail to open



    You can see that the result will failed if the language was Chinese.


    Our workaround is to modify the .jrxml file (to

    remove $F{anchorName}) You can see the table of contents, but no ....

    which is very minor. Then we can open up pdf report.





    Attachments: TOC1.jrxml.txt

    User Feedback

    Recommended Comments



    In order to solve these problems, you\'ll have to do some initializing work.


    1. In order to use CJK (Chinese Japanese Korean) fonts in iText, you need 2 extra jars: iTextAsian.jar and iTextAsianCmaps.jar. They can be found here: http://itext.svn.sourceforge.net/viewvc/itext/trunk/lib. Add these jars in the classpath of your application.


    2. In order to be able to read the text generated with iText using CJK fonts, you also need to download and install a special font pack for Acrobat Reader (or maybe your Reader will ask you to install such a font pack upon opening a PDF file with CJK fonts). A good point to start this is http://www.adobe.com/products/acrobat/acrrasianfontpack.html


    3. Then in the jrxml file you will have to set the pdfFontName attribute with an appropriate font name existing in the adobe reader font pack (for example, pdfFontName="STSong-Light"). Set the pdfEncoding with an appropriate encoding (i.e. pdfEncoding="UniGB-UCS2-H") and set isPdfEmbedded to "false".


    4. If you need to visualize the report in other formats, set the fontName attribute with an appropriate true type font name existing in the chinese windows os, or do use a JRExporterParameter.FONT_MAP export parameter.


    And that\'s all. Please let me know if the problems persist.



    Link to comment
    Share on other sites

  • Create New...