Tandon, Amrish wrote:
> I have based this code from  sections 2.3.1 and 2.3.2 of your book.

Wow, I wrote that book, but my examples work, and I'm not responsible
if you don't follow the advice that is given on this mailing list.

> Also it would make sense to me if you told me what part did not make sense.

Let me quote Paulo's wise words:
"You have to reinitialize baos before using it in PdfStamper,
it was closed in PdfCopyFields."
What part of this answer is not clear to you.

> Also please understand I am new to iText.

Your problem has nothing to do with iText.
You create a baos:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
you use it with PdfCopyFields.
Then the baos is closed and you use the bytes to create
a PdfReader object:
PdfReader reader = new PdfReader(baos.toByteArray());
However, you REUSE the same baos that is already closed
in the next line:
PdfStamper stamper = new PdfStamper(reader,baos);
This doesn't make sense!!!
You should do baos = new ByteArrayOutputStream();
befor creating the new Stamper instance.

Please don't blame the book for this mistake.
*bark* *bark* ;-)
br,
Bruno

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to