Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to render Cyrillic symbols in PDF and jrxml report with JasperReports Library in custom Java application


    akonkin
    • Features: Exporters Product: JasperReports® Library

    You can use the font extension feature that was mentioned in a previous article to achieve the desired result. (http://community.jaspersoft.com/wiki/how-show-cyrillic-letters-pdf)

    In case of a custom Java application, you should create a font extension (manually or with iReport/JasperSoft Studio) and place it in the class path of your Java application. It will then be available to your application.

    The Images below shows how font extensions can be automatically created in iReport:

    1. Font configuration.

      font_configuration(1).png.97f6f221c64b5ff63a6a6575b2697d89.png

    2. Export of the pre-configured fot to font extension jar file.

      how_to_create_font_extension_in_ireport.png.d2552a02d97d0b0ea5bcc75c9e91d31e.png

    Most important configuration lines are in my font extension file (you can find it in the attachments to the article):

    <pdfEncoding><![CDATA[Cp1251]]></pdfEncoding>
    <pdfEmbedded><![CDATA[true]]></pdfEmbedded>
    

    To get the comprehensive information regarding the font extension feature you may want to:

    • Check the sample, supplied with the JasperReports project distribution package, under the /demo/samples/fonts directory, that shows how to work with font extensions. This sample contains jrxml report, configuration files and ttf fonts that should be embedded to the pdf document.

    • Read the detailed explanation regarding the font extension (JasperReports Ultimate Guide v3.7 - Page 294 / SIMPLE FONT EXTENSION TUTORIAL)

    2015-07-29_1233.png.5556dcd0a8ae1298cb55191be675cf46.png

    I have attached to this article a sample of the font extension that was automatically generated by iReport, ttf font and sample of PDF document with  the ttf font embedded into it.

    font_configuration(1).png.8dccd7eb4679a6d39009f213aaff5e85.png

    how_to_create_font_extension_in_ireport.png.259d1efc4115ad4e7400be4a7c234833.png

    2015-07-29_1233.png.0dd4fc868aa8f6e5fbb624620a2e1ebe.png

    test111.pdf

    tahoma_0.jar

    tahoma_0.ttf

    partnertransactionsummaryfds1_0.jrxml


    User Feedback

    Recommended Comments

    There are no comments to display.



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