Hello everyone, I've been assigned a task to try to fill and save a PDF form ASP page. I search on line and I found out that using iTextSharp would help. I also downloaded some examples and tried to follow them but I'm not having much luck. the example I downloaded would find the fields names in the PDF and display them to you which I got that to work and I compaired the fields in adobe just to make sure and it works fine, but the saving part is driving me crazy...

so what I'm trying to do is when I click that button, ASP should get the "Temp.pdf" and fill in the hard coded values below and then save it as "Completed-temp.pdf"

any help or a push in the right direction will be greatly appreciated.
Thanks.

here is the code below:


Protected Sub btnGeneratePDF_Click(sender As Object, e As EventArgs)
Dim chkExemptPayee
Dim rblTaxClassification


Dim pdfPath = ("\\web2\wwwroot\temp.pdf")


' Get the form fields for this PDF and fill them in!
Dim formFieldMap = PDFHelper.GetFormFieldNames(pdfPath)

If rblTaxClassification.SelectedValue IsNot Nothing Then

Dim formFieldName = String.Format("topmostSubform[0].Page1[0].c1_01[0]", rblTaxClassification.SelectedIndex)

formFieldMap(formFieldName) = (rblTaxClassification.SelectedIndex + 1).ToString()
End If


'Fields with values hard coded

formFieldMap("Page 1") = "1"
formFieldMap("Page 2") = "1"

formFieldMap("Conditions of Sale") = ""
formFieldMap("Name & Address") = "DEF456"
formFieldMap("Consignee") = "ABC123"
formFieldMap("Transportation") = ""
formFieldMap("Date 1") = ""
formFieldMap("Other References") = ""
formFieldMap("Purchaser's Name") = "ABC123"
formFieldMap("Country") = "Canada"
formFieldMap("Origin of Country") = "USA"
formFieldMap("Conditions of Sale") = "Sale"
formFieldMap("Currency") = "U.S"

formFieldMap("no1") = ""
formFieldMap("specs") = ""
formFieldMap("Quantity") = ""
formFieldMap("Unit Price") = ""
formFieldMap("Total") = ""

formFieldMap("no2") = ""
formFieldMap("specs2") = ""
formFieldMap("Quantity2") = ""
formFieldMap("Unit Price2") = ""
formFieldMap("Total2") = ""

formFieldMap("no3") = ""
formFieldMap("specs3") = ""
formFieldMap("Quantity3") = ""
formFieldMap("Unit Price3") = ""
formFieldMap("Total3") = ""

formFieldMap("no4") = ""
formFieldMap("specs4") = ""
formFieldMap("Quantity4") = ""
formFieldMap("Unit Price4") = ""
formFieldMap("Total4") = ""

formFieldMap("no5") = ""
formFieldMap("specs5") = ""
formFieldMap("Quantity5") = ""
formFieldMap("Unit Price5") = ""
formFieldMap("Total5") = ""

formFieldMap("no6") = ""
formFieldMap("specs6") = ""
formFieldMap("Quantity6") = ""
formFieldMap("Unit Price6") = ""
formFieldMap("Total6") = ""

formFieldMap("no7") = ""
formFieldMap("specs7") = ""
formFieldMap("Quantity7") = ""
formFieldMap("Unit Price7") = ""
formFieldMap("Total7") = ""

formFieldMap("no8") = ""
formFieldMap("specs8") = ""
formFieldMap("Quantity8") = ""
formFieldMap("Unit Price8") = ""
formFieldMap("Total8") = ""

formFieldMap("no9") = ""
formFieldMap("specs9") = ""
formFieldMap("Quantity9") = ""
formFieldMap("Unit Price9") = ""
formFieldMap("Total9") = ""

formFieldMap("Field 1") = ""
formFieldMap("Check Box") = vbYes
formFieldMap("Net Wt") = ""
formFieldMap("gross Wt") = ""
formFieldMap("Invoice Total") = ""

formFieldMap("Exporter Name") = ""
formFieldMap("Originator") = ""
formFieldMap("Dept. Ruling") = ""
formFieldMap("Cbox2") = vbYes

formFieldMap("TransChgs") = ""
formFieldMap("trans chgs 2") = ""
formFieldMap("ConsCosts") = ""
formFieldMap("ConsCosts2") = ""
formFieldMap("Export pkg") = ""
formFieldMap("Export pkg 2") = ""

formFieldMap("cbox3") = ""
formFieldMap("cbox4") = ""

Dim pdfContents = PDFHelper.GeneratePDF(pdfPath, formFieldMap)
PDFHelper.ReturnPDF(pdfContents, "Completed-temp.pdf")

End Sub