I found this code snippet made with c#
OK, let's say I have a PDF document called "Form.pdf" with 4 form fields. The form fileds are "name", "address", "postal_code" and "email".
Here's the code to create a new PDF file using "Form.pdf" as a template:
Code:private void fillForm() { string formFile = @"N:\.NET\Form.pdf"; string newFile = @"N:\.NET\Filled-out Form.pdf"; PdfReader reader = new PdfReader(formFile); PdfStamper stamper = new PdfStamper(reader, new FileStream( newFile, FileMode.Create)); AcroFields fields = stamper.AcroFields; // set form fields fields.SetField("name", "John Doe"); fields.SetField("address", "2 Milky Way, London"); fields.SetField("postal_code", "XX1 4YY"); fields.SetField("email", "[email protected]"); // flatten form fields and close document stamper.FormFlattening = true; stamper.Close(); }
How would I code this in vb???




Reply With Quote