  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | a question about image | a question about image 2006-08-29 - By o ?
Back <html><div style='background-color:'><DIV class=RTE>hi, </DIV> I have some problems during my development using itext. And I would be very appreciate if you could give me some suggestions. <DIV></DIV> <P> 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: </P> <P> <FONT color=#6666ff> Image jpg = Image.getInstance("pdfhead.png");</FONT></P> <P><FONT color=#000000>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 :</FONT></P> <P><FONT color=#3366ff>java.io.FileNotFoundException : C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\pdfhead.png (The system cannot find the file specified)</FONT></P> <P>It seems that <FONT color=#6666ff>Image.getInstance </FONT><FONT color=#000033>does not find files in the same directory as it is.</FONT></P> <P>So I use another solution to get this image file:</P> <P><FONT color=#3366ff>InputStream in = PdfExport.class.getClassLoader().getResourceAsStream("pdfhead.png");</FONT></P>
<P><FONT color=#3366ff>Image jpg = Image.getInstance(in.toString().getBytes());</FONT></P> <P>And I get another error information :</P> <P><FONT color=#3333ff>The byte array is not a recognized imageformat.</FONT></P> <DIV>I try to modify the image type to bmp,jpg,gif, and I get the same error information.</DIV> <DIV> </DIV> <DIV>Could you give some suggestions?</DIV> <DIV> </DIV> <DIV>Expecting your response!</DIV> <DIV> </DIV> <DIV>Yours,</DIV> <DIV>Yu Fu</DIV></div><br clear=all><hr>?????????????????????????????? <a href="http://g.msn.com/8HMBCNCN/2752??PS=47575" target="_top">MSN Hotmail </a> Get 2 months FREE*. </html>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- 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@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions
|
|
 |