longyu065 / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

No support for all supported iText fonts #129

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Flying Saucer currently only loads Helvetica, Times, and Courier fonts into 
ITextFontResolver class. There currently is no way to add support for iTexts 
other fonts (e.g. Symbol, Zapfdingbats, and those available with the 
iTextAsian.jar).

The only way to get these fonts and to support the CJK languages is to use a 
font file and embedd the font in your PDF files. This is not always acceptable 
as this usually requires licensing of the use of such fonts and significantly 
increases the file size of the generated PDF file.

Please add support for these fonts.

Original issue reported on code.google.com by loe...@gmail.com on 23 Mar 2011 at 2:58

GoogleCodeExporter commented 8 years ago
This should (hopefully) be a straightforward modification of ITextFontResolver 
to add support for additional "hardcoded" fonts.  If you can produce a patch 
that does this (and doesn't introduce a hard dependency on iTextAsian.jar), it 
will definitely be applied.

Original comment by Peter.Br...@gmail.com on 24 Mar 2011 at 12:30

GoogleCodeExporter commented 8 years ago
I'm currently already working on this and will supply the code when complete.

Original comment by loe...@gmail.com on 24 Mar 2011 at 9:11

GoogleCodeExporter commented 8 years ago
Hi,

I am facing the same problem you reported. Did you find a patch for this issue? 

Thanks

Original comment by nthuill...@gmail.com on 12 Dec 2011 at 4:32

GoogleCodeExporter commented 8 years ago
Hi there, 

I am also facing a similar problem - wanting to create pdfs and mail them to 
asian recipients without having to embed 30mB+ of font file.
Has there been any update on this issue? 

Thanks, 

POBroin

Original comment by pierce.o...@gmail.com on 18 May 2012 at 4:43

GoogleCodeExporter commented 8 years ago
Sorry for not responding to the earlier comment about this.  Yes, I modified 
the code to add support for all the itext supported fonts. I also believe that 
the code has been merged into the main stream. Look for branches by me to see 
what font name to use for Japanese, Chinese Korean, etc. The modified file was 
ITextFontResolver. There should be an array called cjkfonts holding all the 
font names. 

Original comment by loe...@gmail.com on 18 May 2012 at 4:52

GoogleCodeExporter commented 8 years ago
Great, thanks very much for the update. I'll try that out now! 
- POBroin

Original comment by pierce.o...@gmail.com on 21 May 2012 at 9:41

GoogleCodeExporter commented 8 years ago
I'm still having trouble getting this to work, and I notice that the path in 
ITextFontResolver.java is to com/lowagie/text/pdf/fonts/cjkfonts.properties, 
but more recent versions of itextasian.jar have com/itextpdf/....
Can you tell me please which version of textasian.jar I should be using? 

thanks in advance, 
POBroin

Original comment by pierce.o...@gmail.com on 21 May 2012 at 3:53

GoogleCodeExporter commented 8 years ago
looks like they updated their packages. I dont believe when these changes were 
made, the itextasian.jar had version number. you may have to go looking for it 
as flyingsaucer doesnt use the new versions

Original comment by loe...@gmail.com on 22 May 2012 at 3:35

GoogleCodeExporter commented 8 years ago
try this one ... 
https://itext.svn.sourceforge.net/svnroot/itext/branches/5xy/lib/iTextAsian.jar

Original comment by loe...@gmail.com on 22 May 2012 at 3:54

GoogleCodeExporter commented 8 years ago
or this ... 
https://itext.svn.sourceforge.net/svnroot/itext/branches/iText-jdk15/lib/iTextAs
ian.jar
or this ... 
https://itext.svn.sourceforge.net/svnroot/itext/branches/iText-jdk13/lib/iTextAs
ian.jar

i dont know what version is newer or if there are any differences .. i'm 
guessing not. I found these in their svn repo ... 
https://itext.svn.sourceforge.net/svnroot/itext/branches/ ... i'm thinking this 
is the newest ... 
https://itext.svn.sourceforge.net/svnroot/itext/branches/iText-jdk15/

Original comment by loe...@gmail.com on 22 May 2012 at 4:00

GoogleCodeExporter commented 8 years ago
newest before package change

Original comment by loe...@gmail.com on 22 May 2012 at 4:00

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
thanks guys, for the prompt responses I'll try that ASAP. 

Original comment by pierce.o...@gmail.com on 23 May 2012 at 11:04

GoogleCodeExporter commented 8 years ago
Hi Guys - I still cannot get this to work :(
I'm using the latest flying saucer source on github, itext 2.1.7, and i'm using 
iTextAsian.jar from iText-jdk15 mentioned in #10 above. 
I am declaring the font in css like this:
font-family:MHei-Medium, arial, sans-serif;
I'm not getting any error, the chinese characters simply do not appear, and in 
document/properties of the generated pdf the font is not mentioned. 
Can someone tell me please is there something obvious I'm missing?  
thanks again, 
POBroin

Original comment by pierce.o...@gmail.com on 28 May 2012 at 1:29

GoogleCodeExporter commented 8 years ago
Use MHei-Medium-H for horizontal and -V for vertical. If that doesn't work then 
my changes haven't been merged into the main stream. Also note that 
flyingsaucer doesn't support compound values for Font-family css property. 

Original comment by loe...@gmail.com on 28 May 2012 at 9:00

GoogleCodeExporter commented 8 years ago
now it works perfectly. Thank you very much for the support.

Original comment by pierce.o...@gmail.com on 29 May 2012 at 10:31