Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7921269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:31:16+00:00 2026-06-03T16:31:16+00:00

I have tried iText, PDFBox & Oracle Forms. And I also succed in case

  • 0

I have tried iText, PDFBox & Oracle Forms. And I also succed in case of iText to generate Gujarati PDF Document. But, unfortunately it is not generating proper Font in Gujarati (UTF-8) language.

I have my project in jdk 1.4 & that is mandatory to use. So, I need older version of API that support Gujarati Font.

Please suggest if any option is available.

Sample Code:

public void GeneratePDFusingiText(String lStrGujaratidata)
  {
    try
    {

      BaseFont bf = BaseFont.createFont("C:\\Windows\\Fonts\\Shruti.ttf",  BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
      Font font = new Font(bf, 12);
      Document document = new Document();
      PdfWriter.getInstance(document, new FileOutputStream("D:/GeneratePDFusingiText.pdf"));
      document.open();
      document.add(new Paragraph(lStrGujaratidata, font));
      document.close();
    }
    catch(Exception e)
    {
      System.out.println("Exception while generating PDF");
      e.printStackTrace();
    }
   } 

EDIT 1:

Perhaps the image is not getting displayed. It is uploaded here.

EDIT 2:

image of font examples

Step-1) I type a gujarati String Google Transliterate.

Step-2) I convert it into unicode using BableMap Software to use it using Resourse Bundle.

Issue: Let me have a String: બિલાડી (Biladi)

It’s unicode will be : \u0AAC \u0ABF\u0AB2\u0ABE\u0AA1\u0AC0

Check the Bold Unicode character above. That is where I am getting the problem. Now if I change this unicode to \u0ABF\u0AAC\u0AB2\u0ABE\u0AA1\u0AC0 , it prints proper output in PDF.

At the same time it prints wrong output in HTML i.e. : િબલાડી

I have to manage in between them.

I have tried using “gu” & “gu.UTF-8” & “UTF-8”. But, everytime I am getting same output.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:31:17+00:00Added an answer on June 3, 2026 at 4:31 pm

    Updated Answer

    After your comment I realised that I was wrong, i.e. the diacritic character should appear second in the byte sequence, even though it should be rendered left of the main character.

    So, it turns out, iText doesn’t support this type of rendering on Indic charactersets. Roughly speaking, iText uses awt’s Graphics2D to render non-Latin unicode characters, one-by-one, as images in the PDF. (I guess this is because appropriate fonts are not necessarily be installed on everyone’s computer). This feature doesn’t take this special ordering into account.

    iText does support similar behaviour for Arabic, using a class contributed by another developer. See com.itextpdf.text.pdf.ArabicLigaturizer. Perhaps you could create a similar one yourself? (!)

    It looks like this has come up before:

    • http://thread.gmane.org/gmane.comp.java.lib.itext.general/56702/focus=59552
    • http://itext-general.2136553.n4.nabble.com/patch-for-complex-scripts-indic-rendering-td2167588.html

    Original Answer

    Kem chho,

    I believe that iText is displaying the correct characters, but the first 2 characters of your input have been ‘flipped’ before you translated the string into unicode points. So, the problem occurred before the data even gets to iText.

    The underlying issue is that the ‘first’ character is a ‘pre-base’ character, which is a type of Diacritic. It’s a bit like an ‘accent’ in European texts, in that it can’t exist on its own, and its purpose is to embellish another character. In this case it turns a ‘Ba’ (બ) into a ‘Bi’.

    You’ll see int the the Unicode Codepage, that the first character (િ) is indeed codepoint \u0ABF, and the second (બ) is \u0AAC : http://en.wikipedia.org/wiki/Gujar%C4%81ti_script#Unicode

    So, somewhere between Google Transliterate and your codepoint representation, these characters got flipped. So, you need to review how you did that translation.

    How did you convert these characters into codepoints?

    Seemingly, some interpreters place the ‘pre-base’ after the main consonant, instead of before it:

    • Note that when you paste those characters into a (Linux) terminal,
      the first 2 characters come out back-to-front. I believe something
      similar happened for you too.
    • You’ll also notice that when you try
      editing this word in Google Transliterate, you can’t place the cursor between
      the first 2 characters, and when you hit backspace, the left
      character is deleted before the right.

    So, if you can work out where this ‘flipping’ occured, then hopefully your solution will present itself.

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried several things so far, but I haven't had much luck yet.
I have tried this but it does not work (even if I specify .wav
I have tried quite a few codes but none of them seem to work
I have tried to find some decent documentation on traversing in jQuery, but have
Have tried to compile and run this program, but have received this error message
I have tried the following but it is giving me errors: print_r($this->session->userdata()); How can
I have tried a bunch of different things but always get syntax errors. I
I have tried : ParentForm.ControlBox = false; ... but it doesn't seem to work
I have tried wcscat() but i get a runtime access violation. wchar_t* a =
have tried a few different approaches to this but with no success so far.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.