Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4583
  • Last Modified:

Set Marathi font (Regional language) to PDF

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
Aurii
Asked:
Aurii
  • 7
  • 6
2 Solutions
 
CEHJCommented:
Is this font file available for us to test?
0
 
objectsCommented:
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
 
AuriiAuthor Commented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
objectsCommented:
shouldn't be any need to see the font
did you try the code above?  did that embed the font ok?
0
 
AuriiAuthor Commented:
'Open type' font ( UTF16 support) Marathi (a Indian Language).
0
 
objectsCommented:
try changing the encoding to BaseFont.IDENTITY_H
0
 
AuriiAuthor Commented:
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
 
objectsCommented:
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
 
AuriiAuthor Commented:
"BaseFont.IDENTITY_H,"  It's not  working properly  ;sequence of alphabet has been change.
0
 
objectsCommented:
what result did you get when you run the code in the link I posted above?
0
 
AuriiAuthor Commented:
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
 
AuriiAuthor Commented:
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
 
objectsCommented:
can you explain exactly how it is wrong
0
 
AuriiAuthor Commented:
The solution solved 20% of my problem. I solved my problem by me own
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now