• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Changing values in a PDF File

 
Ranch Hand
Posts: 224
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a PDF file called "test.pdf" and it has values for all of the fields. The "form" variable of type "AcroFields" contains the field names and values of the PDF file. How would I change the values of the PDF file?

Here is some code that I have so far:
PdfReader reader = new PdfReader("test.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("myFile.txt"));
AcroFields form = stamper.getAcroFields();
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you're using the iText API. Searching for "itext acrofields example" finds http://rkosko.wordpress.com/2013/08/16/create-a-pdf-with-acrofields-with-itext/, which looks promising.
 
Fred Victa
Ranch Hand
Posts: 224
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Sounds like you're using the iText API. Searching for "itext acrofields example" finds http://rkosko.wordpress.com/2013/08/16/create-a-pdf-with-acrofields-with-itext/, which looks promising.



I went to that link and it was very helpful. I was able to change the values in my PDF file. Thank you.
 
get schwifty. tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!