----- Original Message ----- From: "副 俞" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 29, 2006 9:37 AM
Subject: [iText-questions] a question about image


hi,
I have some problems during my development using itext. And I would be very appreciate if you could give me some suggestions. I use a serverlet to receive the data passed by client site. Then I build a pdf file according to the data. And I have to add a image into the pdf file using such as:

  Image jpg = Image.getInstance("pdfhead.png");

It works as a java application and I put the pdfhead.bmp in the same directory as the java file.But in the serverlet I get an error information as :

java.io.FileNotFoundException: C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\pdfhead.png (The system cannot find the file specified)

It seems that Image.getInstance does not find files in the same directory as it is.


Use an absolute path.

So I use another solution to get this image file:

InputStream in = PdfExport.class.getClassLoader().getResourceAsStream("pdfhead.png");

Image jpg = Image.getInstance(in.toString().getBytes());


That will get you the class name not the stream content.

Paulo

And I get another error information :

The byte array is not a recognized imageformat.

I try to modify the image type to bmp,jpg,gif, and I get the same error information.

Could you give some suggestions?

Expecting your response!

Yours,
Yu Fu


--------------------------------------------------------------------------------
ê1ó?êà??é?×?′óμ?μ?×óóê?t?μí3?a MSN Hotmail Get 2 months FREE*.


--------------------------------------------------------------------------------


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


--------------------------------------------------------------------------------


_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to