Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Set Marathi font (Regional language) to PDF

Posted on 2011-03-11
14
Medium Priority
?
4,467 Views
Last Modified: 2012-05-11
I am using itext in my java application for pdf. I want to use Marathi font 'DVOTYogeshIL_N_Ship' which is ISM V6 font and it is true type & 'Open type' font (Unicode support UTF16) Marathi is a Indian Language.
I wrote code as,

FontFactory.register("C:/Windows/Fonts/DVOTYogeshIL_N_Ship.ttf", "DVOTYogeshIL_N_Ship");
Font tempFont = FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.CP1252, BaseFont.EMBEDDED);
System.out.println("tempFont = " + tempFont.getFamilyname());

but its not working. Please help
0
Comment
Question by:Aurii
  • 7
  • 6
14 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 35109137
Is this font file available for us to test?
0
 
LVL 92

Expert Comment

by:objects
ID: 35113484
looks ok
try this example to embed a font and let me know how it goes

One thing to check it that you are using the correct font encoding
0
 

Author Comment

by:Aurii
ID: 35114971
because of extension '.ttf' to font 'DVOTYogeshIL_N_Ship.ttf' its' not possible to attached font file. If possible please send me your mail ID for same.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 92

Expert Comment

by:objects
ID: 35114991
shouldn't be any need to see the font
did you try the code above?  did that embed the font ok?
0
 

Author Comment

by:Aurii
ID: 35115030
'Open type' font ( UTF16 support) Marathi (a Indian Language).
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 35115034
try changing the encoding to BaseFont.IDENTITY_H
0
 

Author Comment

by:Aurii
ID: 35115037
code is here....

         FontFactory.register("C:/Windows/Fonts/DVOTYogeshIL_N_Ship.ttf", "DVOTYogeshIL_N_Ship");

             
            Font tempFont = FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.CP1252,     BaseFont.EMBEDDED);
            System.out.println("tempFont="+tempFont.getFamilyname());
           
           
   PdfPCell cell = new PdfPCell(new Phrase("¿¿¿¿", FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.CP1257,  BaseFont.EMBEDDED, 24, Font.BOLD)));
           
0
 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 35115045
Font tempFont = FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.IDENTITY_H,     BaseFont.EMBEDDED);
System.out.println("tempFont="+tempFont.getFamilyname());
PdfPCell cell = new PdfPCell(new Phrase("¿¿¿¿", FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.IDENTITY_H,  BaseFont.EMBEDDED, 24, Font.BOLD)));
0
 

Author Comment

by:Aurii
ID: 35115768
"BaseFont.IDENTITY_H,"  It's not  working properly  ;sequence of alphabet has been change.
0
 
LVL 92

Expert Comment

by:objects
ID: 35118299
what result did you get when you run the code in the link I posted above?
0
 

Author Comment

by:Aurii
ID: 35145107
If I write " ¿¿¿¿ " through my code then in Pdf it prints wrong word. I have attached the Pdf where the Title is printed wrong instead of " ¿¿¿¿ " ..
bill1.pdf
0
 

Author Comment

by:Aurii
ID: 35145207
If I write " ¿¿¿¿ " through my code then in Pdf it prints wrong word. I have attached the Pdf where the Title is printed wrong instead of " ¿¿¿¿ " ..
0
 
LVL 92

Expert Comment

by:objects
ID: 35145256
can you explain exactly how it is wrong
0
 

Author Closing Comment

by:Aurii
ID: 35230744
The solution solved 20% of my problem. I solved my problem by me own
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question