I have not been able to successfully embed a jpeg obtained from an URL into the PDF 
created by iText. We have had 2 programmers looking at this problem for a couple of 
weeks and can trace the problem back to iText or something that iText is passing to 
java.net.URL.

Here's basically what we are doing and what we see:
 1. Create a string that contains the URL to produce out chart (code at the URL uses 
Jfreechart)
 2. Use the string to create an URL which is passed to Image.getInstance()
 3. Image.getInstance() throws an exception

Here's some example code:
String imageUrl = new StringBuffer(128).append(myinfoUrl)
                  .append("/paysummary/DisplayBarChart.jsp")
                  .append("?userid=").append(userid_)
                  .toString();
Image barChart = Image.getInstance( new URL(imageUrl);


Note that URL string stored in "imageUrl" both looks correct and works when typed in a 
browser window -- the URLs look like:
https://server03.ne.boe.com:8094/paysummary/DisplayBarChart.jsp?userid=12234

The URL returns a jpeg image of a chart (produced by Jfreechart). I can run the code 
using Jbuilder from my desktop machine (which uses http, not https) -- it works fine 
and the chart is put into the PDF. 
But, if I put my java code on our server (which uses https), the getInstance method 
throws an exception. I have seen 2 different errors: 1) stating that the URL does not 
look like a jpeg and 2) a Malformed URL exception is thrown in java.net.URL.

I work on a fairly large development project within Boeing. At this point we are 
frustrated to the point of giving up on iText completely unless we can get this 
problem resolved.

Has anyone seen similar problems with putting images obtained from an Url into an 
iText-produced PDF file? Do you have any recommendations of things to try -- we have 
exhausted our known options. By the way, putting the image in the file system and 
opening it from there works, but that is not an option for the production version of 
our application -- we need to get the image from an URL.

--Harry Wegley



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to