Rishi,

the reason is quite obvious after all... I should have spotted this at the
start...

rishisahi wrote:
> PdfReader reader = new PdfReader(filePath);
> PdfStamper stamper = new PdfStamper(reader, new
> FileOutputStream(filePath));
> AcroFields form = stamper.getAcroFields();
> 

You use the same file for PdfReader input and PdfStamper output.

When the PdfReader is initialized, it reads some data from the file to get
started.

When the FileOutputStream for the PdfStamper is initialized, the file is cut
down to a 0 bytes length.

When you try to read the acroFields, iText also tries to parse the included
XFA form. The XFA form data streams are not yet read, so iText accesses the
file at the position where the streams should be.

Unfortunately the file data have just been thrown away in the step before;
therefore, you get an EOFException.

Thus, use different files for input and output, and the world becomes a
happier place.

Regards,   Michael.
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Error-pdfRandomAccessFileorArray-readFully-RandomAccessFileorRray-java-261-tp2716941p2718440.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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