uploading PDF file results to corrupted file
807580Sep 16 2010 — edited Sep 21 2010Hi,
I have the following java code that saves a pdf file into a local location
tempFile = new File(this.getRecFilename());
ByteArrayOutputStream baos=new ByteArrayOutputStream();
FileInputStream in=new FileInputStream(tempFile);
int read=-1;
while((read=in.read())!=-1) {
baos.write(read);
}
this.setRecData(baos.toByteArray());
It is working perfectly except for this one particular PDF file, once it saves the file to the local directory, the file becomes corrupted. I'm not sure why this happens because I tried out other PDF files that are larger than this one and some other that has editable fields in it but they don't get corrupted.
Please advise.
Thanks in advance!