Val Bumbu wrote:
> Hi,
> 
> I tried to rename AND SAVE fields in a pdf file, basically following 
> HelloWorldStampCopyStamp.java

This is an example from the book, so I assume you
have bought the book.

> RandomAccessFileOrArray letter = new RandomAccessFileOrArray(filename);
> reader = new PdfReader(letter, null);
> File temp = new File(copyname);
> stamper = new PdfStamper(reader, copyname);

Why are you creating temp and what is copyname?
Please read chapter 2.
You'll gain a better understanding of the example.

> form = stamper.getAcroFields();
> form.renameField(fField,sField);
> 
> At this point I could see in the debugger that the field WAS renamed.

You could also have renamed the field after
getting the AcroFields object from the reader.

>                         stamper.close();

And done: as described in the book, and as tested
by many different people: it works as a charm!

> My ‘copyname’ file is losing all the form fields, and is reduced in size.

I'm sorry, but that's hard to believe.

> Any way to rename fields AND SAVE the file with renamed fields?

Yes. Try the examples that come with the book.
They are tested. They work.
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