Solved

Set Marathi font (Regional language) to PDF

Posted on 2011-03-11
14
4,119 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
 
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 250 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 92

Assisted Solution

by:objects
objects earned 250 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
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…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now