Forget about iText for now. Can you get the image into a byte array? Once 
you get there Image.getInstance() will always work.

Paulo

----- Original Message ----- 
From: "Donald Jayawardena" <djayaward...@westpac.com.au>
To: <itext-questions@lists.sourceforge.net>
Sent: Tuesday, February 09, 2010 12:04 AM
Subject: Re: [iText-questions] pdf does not receive image from a servlet


Hi Bruno/Mark,

I do not think iText causes this issue but there is something lacking when 
the
createjpg servlet sent the image to the iText.

1. It (Image.getInstance("http://accord-wf-
dev.unix.srv.westpac.com.au:9704/createjpg/createjpg")) definitely called 
the
servlet createjpg as I can see it from the logs.

I tried the wget command successfully as follows:

C:\tools\wget>wget -O createjpg.jpg -S -v 
http://accord-wf-dev.unix.srv.westpac.
com.au:9704/createjpg/createjpg
--2010-02-09 10:33:33--  
http://accord-wf-dev.unix.srv.westpac.com.au:9704/creat
ejpg/createjpg
Resolving accord-wf-dev.unix.srv.westpac.com.au... 10.2.221.229
Connecting to accord-wf-dev.unix.srv.westpac.com.au|10.2.221.229|:9704... 
connec
ted.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Mon, 08 Feb 2010 23:33:32 GMT
  Server: Oracle Containers for J2EE
  Connection: close
  Content-Type: image/jpeg
Length: unspecified [image/jpeg]
Saving to: `createjpg.jpg'

    [ <=>                                   ] 2,938       --.-K/s   in 0s

2010-02-09 10:33:33 (49.9 MB/s) - `createjpg.jpg' saved [2938]

I opened the file 'createjpg.jpg' using Microsoft Office picture manager
successfully.

I added the following commands before calling Image.getInstance() and 
debugged
line by line in NetBeans6.5.1:

    URL url = new URL("http://localhost:8080/createjpg/createjpg";);
    InputStream is = url.openStream();
    byte buffer[] = new byte[1024];

    while ((i = is.read(buffer)) != -1) {
        System.out.write(buffer, 0, i);
    }

This code did not give any Exception error and returned 4 lines.

If possible, please let me know how I can debug the Image.getInstance() and 
the
servlet createjpg link.

Thanks,

Donald J


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the 
business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ 


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to