I won't pretent to be an expert in this area, but it sounds alot like something is not getting closed out, or reset at the end of
your first run.  Then, when the second runs, it is using stale data of some sort, you might try various out prints to see
if you are getting something odd.
 
Perhaps some resource is not getting set again on the second attempt?
I assume that all subsequent attempts create the same problem?
 
If you want to send me some code, I will look at it. 
It seems that we are both working on similar projects.
I too am returning a PDF with images back to my user for proofing purposes.
 
Bill Ensley
Bear Printing
-----Original Message-----
From: Eric Vandervort [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 6:39 AM
To: Bill Ensley
Subject: Re: [iText-questions] Problem adding images to a pdf

I'm using the outputstream in my servlet, and calling another class to actually create the pdf's into a bytearrayoutputstream.
 
 
Servlet code snippet:
 
            OutputStream out = res.getOutputStream();            
            CreatePDF createPDF = new CreatePDF();
            out = createPDF.Create(path, allUploadedData, parseFile.getWhichDocument(), out);  
            out.close();
 
 
----- Original Message -----
Sent: Tuesday, March 23, 2004 3:42 PM
Subject: RE: [iText-questions] Problem adding images to a pdf

Are you getting no image or no data in an empty image?  do you have Adobe Acrobat? if you do, you can use it to see if the image is not getting written, or if it is getting
written only with empty data.
 
Hope this helps better
Bill Ensley
Bear Printing
-----Original Message-----
From: Eric Vandervort [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 23, 2004 12:37 PM
To: Bill Ensley; [EMAIL PROTECTED]
Subject: Re: [iText-questions] Problem adding images to a pdf

Bill, Thanks for the suggestion.  I tried this and it didn't work.  When I click back, I then click submit again to call the servlet and it does call it successfully and everything else prints fine, except the image.  It seems like that may be the right mode of thinking though, because the first time I run this I get the image, everytime thereafter I do not.
 
Here's the code I entered into my servlet (already had the response coming in):
 
            res.addHeader("Pragma", "No-cache");
            res.addHeader("Cache-Control", "no-cache");
            res.addDateHeader("Expires", 1);

Thanks,
Eric
----- Original Message -----
Sent: Tuesday, March 23, 2004 2:52 PM
Subject: RE: [iText-questions] Problem adding images to a pdf

Back and Forward buttons on a browser to not automatically re-load a page from the server.
 
I solved this problem by adding a no-caching value into the request header.
 
HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
response.addHeader("Pragma", "No-cache");
response.addHeader("Cache-Control", "no-cache");
response.addDateHeader("Expires", 1);
 
hope this helps
Bill Ensley
Bear Printing
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Eric Vandervort
Sent: Tuesday, March 23, 2004 6:20 AM
To: [EMAIL PROTECTED]
Subject: [iText-questions] Problem adding images to a pdf

Hello, I am trying to add an image to a pdf, it seems to work the first time, but if I choose the back button on my browser and try again it's not there.  Its a variable image that is different based on who is creating the pdf.  Any suggestions?
 
Here's my code:
 
if (printSignature) {
   Image jpg = Image.getInstance(path + "/bar/signatures/" + signature + ".jpg");
   jpg.setAbsolutePosition(88, 20);
   cb.addImage(jpg);
   //cb.addImage(jpg, 176, 0, 0, 20, 88, 20);
}
 
Thanks,
Eric
 
 
Eric Vandervort
Applications Analyst/Programmer
Administrative Information Systems
University Of North Carolina at Chapel Hill
Phone: (919) 962-9894
Email: [EMAIL PROTECTED]
Visit My Homepage at http://www.unc.edu/~ericv

Reply via email to