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