• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Changing values in a PDF File

 
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic