Searching resource as the following order.
* Current Directory
* Directory of Entry assembly
* Entry assembly
* Specified assembly
* Calling assembly
* assemblies loaded in AppDomain
* %CommonProgramFiles%\Ujihara\JavaResouces
The details to see JSharpResource class in JSharpLib.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The resources are obtained as JSharpResource$ResourceEnum object. See JSharpLib class. The class doesn't contain any hard coded drive. I recommend you to debug on the system.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately it's on a production server so I can't put VS 2005 on it. However what I have determined is the problem occurs because it cannot find the windows fonts and tries to use the internal fonts. So...
1) I think the problem is it is never able to find these afm files but it doesn't matter on other systems because on them it finds the Windows fonts. Do I need to call Assembly.LoadFile() or something liek that in itext.dll?
2) For loading the fonts, I think iTextDotNet should get the windows directory, add fonts to it, and pass that directory in during initialization as where to look for fonts. I know the java version has c:\windows\fonts hardcoded as one to try but for the .NET version it can get the windows directory and just use that.
??? - thanks - dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have to call FontFactory.registerDirectories() in order to search Windows font automatically.
See UsingFontFactory sample code <http://www.ujihara.jp/iTextdotNET/examples/com/lowagie/examples/fonts/getting/UsingFontFactory.java>.
Java version is hard-coded but .NET version get the location of font directory from Windows registry.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I may have an old version of FontFactory.java - it still shows the list of directories used in the java world. If my version is out of date, where is the latest .NET 2.0 version?
If it is still that way, to use the Windows location you can get the fonts directory location from the following registry location:
I tried that and still got the error. I call the Assembly.Load() before I make any calls into iText but once I do call into iText, if it can't find the windows fonts, I get this error.
This only happens if it cannot find the windows fonts.
??? - thanks - dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should call FontFactory.registerDirectory(String) to add a Windows font directory in a TrueType font searching list.
Assembly.Load() is only for reading CLR resuorces.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi;
I am getting the following error on one system only:
Helvetica-Bold not found as resource. (The *.afm files must exist as resources in the package com.lowagie.text.pdf.fonts)
One thing unusualy about this system, Windows is installed on drive E:, not C:. Is it possible iTextDotNet looks for fonts in C:\windows\fonts?
Or could it be something else?
thanks - dave
Searching resource as the following order.
* Current Directory
* Directory of Entry assembly
* Entry assembly
* Specified assembly
* Calling assembly
* assemblies loaded in AppDomain
* %CommonProgramFiles%\Ujihara\JavaResouces
The details to see JSharpResource class in JSharpLib.
The resources are obtained as JSharpResource$ResourceEnum object. See JSharpLib class. The class doesn't contain any hard coded drive. I recommend you to debug on the system.
Unfortunately it's on a production server so I can't put VS 2005 on it. However what I have determined is the problem occurs because it cannot find the windows fonts and tries to use the internal fonts. So...
1) I think the problem is it is never able to find these afm files but it doesn't matter on other systems because on them it finds the Windows fonts. Do I need to call Assembly.LoadFile() or something liek that in itext.dll?
2) For loading the fonts, I think iTextDotNet should get the windows directory, add fonts to it, and pass that directory in during initialization as where to look for fonts. I know the java version has c:\windows\fonts hardcoded as one to try but for the .NET version it can get the windows directory and just use that.
??? - thanks - dave
You have to call FontFactory.registerDirectories() in order to search Windows font automatically.
See UsingFontFactory sample code <http://www.ujihara.jp/iTextdotNET/examples/com/lowagie/examples/fonts/getting/UsingFontFactory.java>.
Java version is hard-coded but .NET version get the location of font directory from Windows registry.
I may have an old version of FontFactory.java - it still shows the list of directories used in the java world. If my version is out of date, where is the latest .NET 2.0 version?
If it is still that way, to use the Windows location you can get the fonts directory location from the following registry location:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders]
"Fonts"="C:\\WINDOWS\\Fonts"
> If my version is out of date, where is the latest .NET 2.0 version?
Oops. This feature is implemented only in a .NET Framework 1.1 version. I'll add it in the next version.
Addtionally, FontFactory.registerDirectory(String dir) method adds a directory path in the list for searching a font.
Hi;
The other question is why does it not find the .afm files. Is there som load call I need to do like the LoadFile("iTextAsian")?
thanks - dave
> I need to do like the LoadFile("iTextAsian")?
Yes, because .NET Framework can't find a resource in the other assembly until the assembly is loaded.
I tried that and still got the error. I call the Assembly.Load() before I make any calls into iText but once I do call into iText, if it can't find the windows fonts, I get this error.
This only happens if it cannot find the windows fonts.
??? - thanks - dave
You should call FontFactory.registerDirectory(String) to add a Windows font directory in a TrueType font searching list.
Assembly.Load() is only for reading CLR resuorces.
So should I do Assembly.Load("iText")?
thanks - dave