Skip to content

Gujarati Text Not Rendering Correctly in JasperReports PDF Output #561

Closed

Description

@jayeshsony

Gujarati text is not rendered correctly in PDFs generated using JasperReports, even though the font is properly embedded and Unicode encoding is used.

The generated PDF shows broken or incorrectly shaped Gujarati characters (matras and ligatures), while the same text renders perfectly in browsers or other PDF generators.

Observations:

pdffonts confirms the font is embedded correctly (CID TrueType, Identity-H)

Font used: Anek Gujarati (Unicode)

Image

Issue persists across multiple JasperReports versions (6.20.x / 6.21.x)

The same text renders correctly when generated via HTML → PDF or image-based rendering

This indicates a limitation in JasperReports' text rendering (Java2D) for complex Indic scripts.

Activity

  1. dadza commented on Dec 28, 2025

    @dadza
    Collaborator

    There's a Unicode sample report in the JasperReports sources that includes Gujarati text rendered with the Noto Sans Gujarati font. See at https://github.com/Jaspersoft/jasperreports/tree/74d586df47b25dbd05bd0957999819196e59934a/jasperreports/demo/samples/unicode

    Can you run that sample report and check the Gujarati text in the PDF output?

    Thank you,
    Lucian

  2. jayeshsony commented on Dec 29, 2025

    @jayeshsony
    Author

    Hi Lucian,

    I ran the Unicode sample report from the JasperReports repository as suggested.

    As you can see in the attached screenshot, the Gujarati text is not rendering correctly in the generated PDF — it appears as square boxes. This happens specifically for Gujarati, while other languages (like Hindi, Marathi, Tamil, etc.) are rendered properly.

    So even in the official sample report, the issue persists for Gujarati when using the current font setup. This further indicates that the problem is related to how the Gujarati font (such as Anek Gujarati) is being embedded or handled during PDF generation.

    Image

    Thanks,
    Jayesh

  3. dadza commented on Dec 29, 2025

    @dadza
    Collaborator

    Please share a report (and PDF output) to reproduce the issue that you're experiencing.

  4. jayeshsony commented on Dec 29, 2025

    @jayeshsony
    Author

    font_issue_jrxml_code.txt

    font_issue.pdf

    Characters appear distorted or improperly joined, even though other Gujarati fonts work fine. This issue occurs only with the Anek Gujarati font during PDF export

    I’m unable to attach the TTF file here so I converted the ttf as txt and sent you, and the font used is Anek Gujarati. The issue occurs specifically with this font during PDF generation.

    anek-gujarati.txt

  5. dadza commented on Dec 30, 2025

    @dadza
    Collaborator

    Please attach a minimal and self contained sample report that can be used to reproduce the issue.

  6. jayeshsony commented on Jan 2, 2026

    @jayeshsony
    Author
  7. dadza commented on Jan 2, 2026

    @dadza
    Collaborator

    Thank you.

    Can you also please attach the PDF output that you are getting and explain what is wrong with it and what the expected result?

  8. jayeshsony commented on Jan 6, 2026

    @jayeshsony
    Author

    The Gujarati text “સુરેશ જુકેસ” is written correctly and renders properly in preview as well as when using other Gujarati fonts.
    However, when the Anek Gujarati font is used, the generated PDF visually renders the text incorrectly, appearing as “સરુશે, જકુસે”.

    Interestingly, when the text is copied from the PDF or extracted using any AI/text tool, it is read and written correctly as “સુરેશ જુકેસ”.

    This clearly indicates that the issue is not with the actual text data or Unicode encoding, but only with the visual rendering of the Anek Gujarati font in the PDF output.

    sample_report.pdf

  9. dadza commented on Jan 8, 2026

    @dadza
    Collaborator

    Can you share a PDF where the text is rendered correctly using another font?

  10. jayeshsony commented on Jan 9, 2026

    @jayeshsony
    Author

    The PDF has been generated using the Arial Unicode MS font, and the text is now rendered correctly.

    report_with_arial_unicode_font.pdf

  11. dadza commented on Jan 9, 2026

    @dadza
    Collaborator

    So the problem seems to be the placement of the two vowels ુ and ે relative to the consonants in the words. Can you confirm that?

  12. jayeshsony commented on Jan 12, 2026

    @jayeshsony
    Author

    Yes, that’s correct.

  13. jayeshsony commented on Mar 17, 2026

    @jayeshsony
    Author

    Any update on this?

  14. dadza commented on May 15, 2026

    @dadza
    Collaborator

    The problem has been resolved in a OpenPDF fork maintained by Jaspersoft. The commit that fixes the issue is Jaspersoft/OpenPDF@33eecab

    You can find an OpenPDF jar containing the fix at https://jaspersoft.jfrog.io/ui/native/third-party-ce-artifacts/com/github/librepdf/openpdf/1.3.43.jaspersoft.2-SNAPSHOT/

    JasperReports depends on the forked OpenPDF version at the moment. For the future we will create a pull request so that the fix gets into the official OpenPDF code.

    Regards,
    Lucian

  15. added a commit that references this issue on May 15, 2026
    15de3d1
  16. dadza commented on May 20, 2026

    @dadza
    Collaborator

    An improvement of the initial OpenPDF solution has been checked in at Jaspersoft/OpenPDF@c82bc87

    The latest snapshot can be found at https://jaspersoft.jfrog.io/ui/native/third-party-ce-artifacts/com/github/librepdf/openpdf/1.3.43.jaspersoft.2-SNAPSHOT/

  17. melloware commented on Jun 1, 2026

    @melloware

    @dadza please don't forget to provide upstream PR's to OpenLibre as this has broken Quarkus JasperReports because GRaalVM cannot find that method in the custom JAR we are using an official Quarkus OpenLibre jar.

    See: quarkiverse/quarkus-jasperreports#284

  18. melloware commented on Jun 1, 2026

    @melloware

    cc @andreasrosdal and @asturio it looks like JasperReports is making patches of OpenLibre to fix issues...

  19. dadza commented on Aug 20, 2026

    @dadza
    Collaborator

    FYI two OpenPDF pull requests have been created for the Jaspersoft OpenPDF 1.3.43 changes:

    LibrePDF/OpenPDF#1617
    LibrePDF/OpenPDF#1618

    Regards,
    Lucian

  20. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions