Adding one more thing. On the machine on which it worked fine, if I move the Arial MS Unicode font to some other directory then Japanese fonts don't appear. If I move it back to the original directory then Japanese fonts start appearing again. This font is being used somewhere
Abhishek -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Abhishek Vaidya Sent: Tuesday, May 01, 2007 6:07 PM To: Post all your questions about iText here Subject: Re: [iText-questions] query regarding japanese fonts notappearinginthe PDF Here are the PDFs attached. I will go through the link you gave Abhishek -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paulo Soares Sent: Tuesday, May 01, 2007 5:58 PM To: Post all your questions about iText here Subject: Re: [iText-questions] query regarding japanese fonts notappearingin the PDF I would like to see one PDF that works and one PDF that doesn't. Based on what you say you did, it shouldn't have worked in any machine. Have a look at http://downloads.sourceforge.net/jfreechart/jfreechart2pdf-v2.pdf. Paulo ----- Original Message ----- From: "Abhishek Vaidya" <[EMAIL PROTECTED]> To: "Post all your questions about iText here" <[email protected]> Sent: Tuesday, May 01, 2007 1:00 PM Subject: Re: [iText-questions] query regarding japanese fonts not appearingin the PDF > Hi, > My apologies for the delay in response. Actually I was trying few > things on this on different machines. > > As suggested I broke the conversion into steps. The characters occur > in the JPanel. Our use case is that we first use Icebrowser to render > the URL as a JPanel and then use itext to convert this to PDF. All this > is done using APIs provided by cold fusion. (I am not aware of the > internals of the code). I tested this on 3 red hat machines. On all > three machines ice browser ( I used the web start of ice browser on > www.icesoft.com) displayed the Japanese fonts correctly (I tried > www.google.co.jp) which confirms that fonts are present on the machine > (I installed Arial Unicode MS true type on the machine following the > steps in found on internet). > > Now on one of the machines the converted PDF (after using itext) shows > the Japanese characters fine but on the other two machines the > characters don't appear. The code was same on all 3 machines. This is > for sure that it's not a code problem as it is working fine on a linux > box. I have called the FontMapper.registerDirectories() which registers > a list of directory, before calling the cold fusion API. I had put the > arial Unicode font in /usr/X11R6/lib/X11/fonts/TTF which is being > registered by this method. > > When I see the properties of the converted PDF (ctrl D -> fonts tab), > it shows 3 fonts in the PDF displaying Japanese characters and only 2 > fonts in the PDF where Japanese characters weren't there. The missing > font was in fact Arial MS Unicode which means that itext couldn't pick > this font. > > I ran the unix command "chkfontpath" which shows that the > "/usr/X11R6/lib/X11/fonts/TTF" is in the font path. But still itext > can't find the font. Any pointers further? > > Thanks > Abhishek > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Paulo Soares > Sent: Wednesday, April 25, 2007 5:09 PM > To: Post all your questions about iText here > Subject: Re: [iText-questions] query regarding japanese fonts > notappearingin the PDF > > Let's break the problem in simpler pieces. > > Can you see the characters in the JPanel (pretend that iText doesn't > exist)? > If you can, everything is well installed in Linux, if you can't you'll > have > to tell Java where to find the fonts and that's outside the scope of > iText. > > Assuming that the problem above was solved or never existed, you'll have > to > register the fonts in DefaultFontMapper and make sure that the names > match. > Of course, if you used PdfContentByte.createGraphicsShapes() you won't > need > to register any font as the font outlines will be drawn. I'm curious > about > what code you used in Windows as just adding a font in windows/fonts is > not > enough for iText. > > Paulo > > ----- Original Message ----- > From: "Abhishek Vaidya" <[EMAIL PROTECTED]> > To: "Post all your questions about iText here" > <[email protected]> > Sent: Wednesday, April 25, 2007 12:08 PM > Subject: Re: [iText-questions] query regarding japanese fonts not > appearingin the PDF > > >> Hi, >> >> The version of registerDirectories() on my machine is same as you > have >> mentioned below. I tried registering one of my own directories too by >> using the API >> public int registerDirectory(String dir) >> >> Even this didn't work. Otherwise also I am calling >> registerDirectories() method which should register the below list of >> directories. But even adding Unicode fonts to these directories didn't >> work. I think it's a pure configuration issue (no problem with the > code >> as its working fine on windows). >> >> Is it related to the .properties files in JRE/lib that map java fonts > to >> physical fonts? Or is it anything about registering the fonts with the >> JVM? >> >> Abhishek >> >> >> >> -----Original Message----- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of >> Peter B. West >> Sent: Wednesday, April 25, 2007 2:48 AM >> To: Post all your questions about iText here >> Subject: Re: [iText-questions] query regarding japanese fonts not >> appearing in the PDF >> >> Peter B. West wrote: >>> Abhishek Vaidya wrote: >>>> Hi, >>>> >>>> I am using cold fusion for web capture (converting websites to >> PDF). >>>> It uses Ice Browser to capture the web page as a java.awt panel > which >> is >>>> converted to PDF using itext. Our product is supported on windows > and >>>> unixes. On windows the code is working fine and displaying the >> Japanese >>>> characters for websites (I tried http://www.google.co.jp >>>> <http://www.google.co.jp/> ). Earlier I was facing problem on > windows >>>> about Japanese fonts not appearing in the PDF created using itext. >>>> Then I figured out that the font Arial Unicode MS (true type) is >> requited >>>> under c:\windows\fonts (or other Unicode fonts would even do. They >> were >>>> somehow missing on my machine). When I added this font everything is >>> working >>>> fine. But when I run the same code on linux red hat the Japanese >> characters >>>> are not appearing. The itext.jar contains a class FontFactory which >> has a >>>> method registerDirectories() which registers a few directories >> containing >>>> fonts with itext for windows and unixes. >>>> >>>> >>>> >>>> 1)I added the Arial Unicode MS (true type) (from windows) to a > couple >> of >>>> directories which are used in this method (like >>> /usr/X11R6/lib/X11/fonts/TTF >>>> and /usr/X11R6/lib/X11/fonts/truetype) but itext did not pick up the >>> fonts. >>> >>> I don't know which version of the code you are running, but the >> current >>> CVS code of registerDirectories() looks like this >>> >>> /** Register fonts in some probable directories. It usually works >> in >>> Windows, >>> * Linux and Solaris. >>> * @return the number of fonts registered >>> */ >>> public int registerDirectories() { >>> int count = 0; >>> count += registerDirectory("c:/windows/fonts"); >>> count += registerDirectory("c:/winnt/fonts"); >>> count += registerDirectory("d:/windows/fonts"); >>> count += registerDirectory("d:/winnt/fonts"); >>> count += registerDirectory("/usr/X/lib/X11/fonts/TrueType"); >>> count += >> registerDirectory("/usr/openwin/lib/X11/fonts/TrueType"); >>> count += >> registerDirectory("/usr/share/fonts/default/TrueType"); >>> count += registerDirectory("/usr/X11R6/lib/X11/fonts/ttf"); >>> count += registerDirectory("/Library/Fonts"); >>> count += registerDirectory("/System/Library/Fonts"); >>> return count; >>> } >>> >>> >>> Note that /usr/X/lib/X11/fonts/TrueType will generally require a link >>> from /usr/X11R6 to /usr/X. In my experience, the link, when it is >>> present, is from /usr/X11R6 to /usr/X11, but I don't know what >> Solaris, >>> for example, does. These directories won't work for me (SuSE 10.2), >> but >>> you can always use >>> >>> /** Register all the fonts in a directory. >>> * @param dir the directory >>> * @return the number of fonts registered >>> */ >>> public int registerDirectory(String dir) >>> >>> Have you tried it? >>> >> >> The code quoted is from com.lowagie.text.FontFactoryImp.java. >> >>> >>> Peter ------------------------------------------------------------------------ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/ ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
