Hi Paulo,

> BaseFont will look for the file in the path you give but if it's not
found
> it tries the classpath.

There seems to be a problem: My images and the ttf-fonts are placed in
the same directory. I create my images/basefonts with the following
calls:
Image image =
Image.getInstance(PdfCreator.class.getResource("/sv.wmf"));
BaseFont font = BaseFont.createFont("/arial.ttf", BaseFont.IDENTITY_H,
BaseFont.EMBEDDED, true, null, null);

As you can see, for the images I'm using the Classloader and it works. I
can't do that similar for the BaseFont, because there's no constructor
which takes a url. So I give him the string to search the classpath, but
it seems that iText tries only to find the file and throws an exception
if it's not existent instead of searching the classpath:

java.io.FileNotFoundException: \arial.ttf (Das System kann die
angegebene Datei nicht finden)
        at java.io.RandomAccessFile.open(Native Method)
        at com.lowagie.text.pdf.TrueTypeFontUnicode.<init>(Unknown
Source)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:200)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:94)
        at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
        at com.lowagie.text.pdf.RandomAccessFileOrArray.<init>(Unknown
Source)
        at com.lowagie.text.pdf.TrueTypeFont.process(Unknown Source)

Do you have an idea what's going wrong?

Thanks,

Thorsten




-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to