Click here to Skip to main content
13,000,469 members (58,313 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hey everyone, im new to iTextSharp, i wanted to have a new pdf file by update the existing template pdf, and i followed this tutorial

i have a problem with fillPDFForm()
this is my code:
public string P_InputStream = "template/test.pdf";
public string P_OutputStream = "output/test.pdf";
 public template()
private void template_Load(object sender, EventArgs e)
     string formFile = P_InputStream;
     string newFile = P_OutputStream;
     PdfReader reader = new PdfReader(formFile);
     using (PdfStamper stamper = new PdfStamper(reader, new FileStream(newFile, FileMode.Create)))
         AcroFields fields = stamper.AcroFields;
         // set form fields
         fields.SetField("customerName", "John Doe");
         fields.SetField("Address", "xxxxx, yyyy");
         fields.SetField("Test", "12345");
         // flatten form fields and close document
         stamper.FormFlattening = true;

after the form load, the data inside the pdf file is still the same, din't update. perhaps i dint create the pdf file properly? this is how i did:
1. i open a open office writer
2.Insert Fields>under Variables tab>choose "Set Variable" for Type and "General for Format
3.type the name, and click Insert.
4. File>Export as PDF

am i doing this right?
Posted 5-Dec-12 21:32pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

nothing wrong with the code, is the way how we create the pdf file, follow this tutorial:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100