• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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: 43028
76
  • 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.
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic