That error is almost impossible to happen. The constructor is:

    public RandomAccessFileOrArray(String filename) throws IOException {
        File file = new File(filename);
        if (!file.canRead()) {
            InputStream is = BaseFont.getResourceStream(filename);
            if (is == null)
                throw new IOException(filename + " not found as file or
resource.");
        // read form the resource here ...
        }
        this.filename = filename;
        rf = new RandomAccessFile(filename, "r");
    }

What happened in your case was that the file was found and could be read but
the actal opening of the file failed. In other words File.canRead() lied.
Other possibility is that you are using an old iText version.

Best Regards,
Paulo Soares

----- Original Message -----
From: "Thorsten Sch�fer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 08, 2003 10:29
Subject: RE: [iText-questions] Howto get a Basefont without using explicit
paths


> 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
>




-------------------------------------------------------
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