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.
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());
And I get another error information :
The byte array is not a recognized imageformat.
使用世界上最大的电子邮件系统― 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 iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions