It is currently Fri May 18, 2012 4:51 pm


Post a new topicPost a reply Page 1 of 1   [ 2 posts ]
Author Message
 Post subject: Itext Embeded font problem
PostPosted: Tue Sep 21, 2010 7:33 am 
Site Admin

Joined: Sat Aug 02, 2008 8:00 am
Posts: 147
Hi I created a program using IText and having strange beavior
I'm trying to create documents in Arabic and I managed to do that using IText but I want to make the document without having to embed the font file in the document.

The problem is that When I write in Arabic it takes much more file size than when I make it in english
I found that the problem is in the encoding of the text that I'm using. which is IDENTITY_H but if I cahnge the encoding the Arabic will be corrupted or will not be displayed

Here is the code I'm using to create the font

Code:
BaseFont baseFont = null;
          
           try {
               baseFont = BaseFont.createFont(fontFileName, BaseFont.IDENTITY_H, true);
   
           } catch (Exception e) {
               e.printStackTrace();
           }   
           Font arabicFont = new Font(baseFont, size);
           arabicFont.setColor(color);
           arabicFont.setStyle(style);
           return arabicFont;


The sytle I'm using is Bold and the size is 12
when I change the size of the font The size of the generated document does not change which is logical but when I change the font style from bold to normal it reduces a little bit.

Another thing in this code is that when I change the embeded flag to true the size does not change at all hich means that the font was not embeded.

This is getting me very confused :(

_________________

Muhammad Safwat Fuad
The Java Code Admin
Java Technical Lead.
Mobile: +2010-2942-538
Email:mtv134@yahoo.com


Top
 Profile Send private message  
 
 Post subject: Re: Itext Embeded font problem
PostPosted: Tue Sep 21, 2010 3:42 pm 
Site Admin

Joined: Sat Aug 02, 2008 8:00 am
Posts: 147
I found the following regarding the PDF file format
for Arabic and all other non winansi encoded characters the fonts has to be embedded as a restriction from the PDF file format so all PDF creators including IText will embed the font even if you put the embedded flag to false when it uses a non win ansi encoding and that is what was making confusion for me regarding the file size
the other thing is that when embedding a type one font the complete font file will be embedded but when it comes to true type fonts only the needed subset of the font will be embedded which makes the size of the PDF file reasonable.

_________________

Muhammad Safwat Fuad
The Java Code Admin
Java Technical Lead.
Mobile: +2010-2942-538
Email:mtv134@yahoo.com


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 2 posts ]


Who is online

Registered users: enlaraHes, europhory, momSmubcuct


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
twilightBB Style by Daniel St. Jules of Gamexe.net

[
SEO MOD © 2007 StarTrekGuide ]