Damaged PDF
- From: Divya Bhargov <divya.bhargov (at) gmail.com>
- Date: Fri, 10 Feb 2006 09:27:23 +0800
Hi,
I have used itext.jar to generate PDF (PdfStamper to stamp the form fields) and its been quite good. I have faced one problem only on our producution server from yesterday and I have no idea how to fix it. When I try to open/save the PDF, I get an alert box that the file is not a supported file type or is damaged. This happened out of the blue. The same code worked until yesterday with no problems.
I would appreciate if somebody can help me out this problem asap.
Here is the code I am using. 'fieldMap' is a hashtable that contains the data values.
PdfStamper stamp = new PdfStamper(reader, new DataOutputStream( response.getOutputStream() ));
AcroFields form = stamp.getAcroFields();
for(Iterator i = reader.getAcroForm().getFields().iterator(); i.hasNext();) {
PRAcroForm.FieldInformation field = (PRAcroForm.FieldInformation) i.next();
field.getInfo();
value="";
if(fieldMap.get(field.getName())!=null)
{
value = (String) fieldMap.get(field.getName
());
form.setField(field.getName(),value);
}
}
stamp.close();
thanks and regards,
Divya