• Post Reply Bookmark Topic Watch Topic
  • New Topic

PDF File will not update  RSS feed

 
Fred Victa
Ranch Hand
Posts: 206
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using iText to update a field in a PDF file. I'm trying to update a field, but it will not update. It takes a blank PDF file called "OriginalFile" and it is supposed to create a destination file called "DestinationFile." Do you know why the field will not update? Even though the line of code " form.setField("Name", "Joe");" is executed after "PdfStamper stamper2 = new PdfStamper(reader, new FileOutputStream(DestinationFile));", the field is supposed to be updated with a new value.


try
{
PdfReader reader = new PdfReader(OriginalFile);
PdfStamper stamper2 = new PdfStamper(reader, new FileOutputStream(DestinationFile));
AcroFields form = stamper2.getAcroFields();
form.setField("Name", "Joe");
stamper2.close();
}
catch(Exception e)
{
e.printStackTrace();
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!