Solved

Set Marathi font (Regional language) to PDF

Posted on 2011-03-11
14
4,197 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

808 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