0

When I am generating pdf from .jrxml file using java, hindi fonts are not printing correctly.

eg :

रक्त is printing as रक् त
दैनिक is printing as दैनकि

I have set font in pdf using jasper properties :

JRProperties.setProperty("net.sf.jasperreports.default.pdf.font.name",JASPER_PDF_FONT_FILE);

JRProperties.setProperty("net.sf.jasperreports.default.pdf.encoding","Identity-H");
JRProperties.setProperty("net.sf.jasperreports.default.pdf.embedded","true");

I am not getting why it is printing like this.

I am using JasperReports not iText.

Neha Pateliya
  • 61
  • 1
  • 10
  • This are related http://stackoverflow.com/questions/36600311/how-to-export-fonts-in-gujarati-indian-language-to-pdf and this http://stackoverflow.com/questions/34287186/how-can-i-render-hindi-correctly-when-exporting-to-pdf/34287509#34287509, since you should use font-extension, but the problem here is that itext lib probably can't render that text, see the different answers for a solution – Petter Friberg Sep 15 '16 at 09:08
  • @Petter Friberg : What exactly the problem is in my code? – Neha Pateliya Sep 15 '16 at 09:37
  • What exact language are you using?, itext the library that create's pdf can't render Ligaturizer correctly, see the answer on post to find a work around – Petter Friberg Sep 15 '16 at 09:47
  • I have seen your edit to post, Note: jasper-reports uses **itext** to generate the pdf – Petter Friberg Sep 15 '16 at 09:48
  • jasper reports with java – Neha Pateliya Sep 15 '16 at 12:15
  • 1
    you can try your font directly with itext see this http://stackoverflow.com/questions/35127956/how-can-i-test-if-my-font-is-rendered-correctly-in-pdf – Petter Friberg Sep 15 '16 at 19:21
  • Thank You :) Its working when using String TEST = "रक्त दैनिक"; IndicLigaturizer indicLigaturizer = new DevanagariLigaturizer(); String processed = indicLigaturizer.process(TEST); Is there any solution that can support all languages? – Neha Pateliya Sep 16 '16 at 07:10
  • "all languages, I do not really know", but latest version of jasper-reports uses a new method to go around the problem of itext. see this answer http://stackoverflow.com/a/36688145/5292302 – Petter Friberg Sep 16 '16 at 07:48
  • दैनिक is printing as दैनकि correctly but still रक्त is printing as रक् त , हिन्दी is printing as हिन् दी. Half letters(HALANT) is not printing correctly – Neha Pateliya Sep 17 '16 at 06:35
  • @PetterFriberg: Can you please help for HALANT hindi letters? दैनिक is printing as दैनकि correctly but still रक्त is printing as रक् त , हिन्दी is printing as हिन् दी. Half letters(HALANT) is not printing correctly – Neha Pateliya Sep 19 '16 at 12:55
  • You can try with different fonts, but I think the best solution is to upgrade to latest see jasper-report see this post http://stackoverflow.com/questions/36600311/how-to-export-fonts-in-gujarati-indian-language-to-pdf/36688145#36688145 – Petter Friberg Sep 19 '16 at 12:58
  • Solved this issue using JasperReports 6.2.2 with fonts Noto Sans and exported font using jasperreports_extension.properties – Neha Pateliya Sep 22 '16 at 06:38
  • Perfect great!, have fun! – Petter Friberg Sep 22 '16 at 06:48

0 Answers0