These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

VB .NET - Attempting to change the icon (image) of a PDF button programatically?

way2krazy
Registered: Dec 15 2010
Posts: 3

Hey guys,
 
I am using the following code to populate PDF fields on a template PDF form I have.. the form also has a company logo in the top left that used to be un-changeable in the PDF form... but now I want to change it, so I deleted the logo image and replaced the image with a button on the form. I need to change the button's icon property programmatically using vb .net How do I do that? :
     
Dim pdfReader As New PdfReader(pdfTemplate)
Dim pdfStamper As New PdfStamper(pdfReader, New FileStream(newFile, FileMode.Create))
Dim pdfFormFields As AcroFields = pdfStamper.AcroFields
Dim TempPDFFilename As String = newFile
   
pdfFormFields.SetField("LeaseDate", vsLeaseDate)
pdfFormFields.SetField("Lessor", vsLessor)
pdfFormFields.SetField("Lessee", vsLessee)
pdfFormFields.SetField("Suites", vsSuites)
pdfFormFields.SetField("Floors", vsFloors)
pdfFormFields.SetField("RentableSqFt", vsRentableSqft)
pdfFormFields.SetField("UsableSqFt", vsUsableSqft)
pdfFormFields.SetField("PremisesLocation", vsPremisesLocation)
pdfFormFields.SetField("PremisesCity", vsPremisesCity)
pdfFormFields.SetField("PremisesCounty", vsPremisesCounty)
pdfFormFields.SetField("PremisesState", vsPremisesState)
pdfFormFields.SetField("PremisesZipCode", vsPremisesZipcode)
pdfFormFields.SetField("LeaseBaseRent", vsLeaseBaseRent)
pdfFormFields.SetField("LeaseCommencementDate", vsLeaseCommencementDate)
pdfFormFields.SetField("LeaseExpirationDate", vsLeaseExpirationDate)
pdfFormFields.SetField("PaidSecurityDeposit", vsPaidSecurityDeposit)
pdfFormFields.SetField("AddendumBody", vsAddendumBody)
pdfFormFields.SetField("PremisesAddressFull", vsPremisesAddressFull)
pdfFormFields.SetField("LeaseProratedBaseRent", vsLeaseProratedRent)
pdfFormFields.SetField("LessorLine2", vsLessorLine2)
pdfFormFields.SetField("LesseeLine2", vsLesseeLine2)
pdfFormFields.SetField("LessorNamePrinted", vsLessorNamePrinted)
pdfFormFields.SetField("Lessee1NamePrinted", vsLesseeNamePrinted)
pdfFormFields.SetField("LessorTitle", vsLessorTitle)
pdfFormFields.SetField("Lessee1Title", vsLesseeTitle)
pdfFormFields.SetField("Lessee2NamePrinted", vsLessee2NamePrinted)
pdfFormFields.SetField("Lessee2Title", vsLessee2Title)
pdfFormFields.SetField("Lessor2Title", vsLessor2Title)
pdfFormFields.SetField("LessorAddressLine1", vsLessorAddressLine1)
pdfFormFields.SetField("LesseeAddressLine1", vsLesseeAddressLine1)
pdfFormFields.SetField("LessorAddressLine2", vsLessorAddressLine2)
pdfFormFields.SetField("LessorAddressLine2", vsLessorAddressLine2)
pdfFormFields.SetField("Lessorworkphone", vsLessorWorkPhone)
pdfFormFields.SetField("Lessorfaxphone", vsLessorFaxPhone)
pdfFormFields.SetField("Lessorhomephone", vsLessorHomePhone)
pdfFormFields.SetField("LessorCellphone", vsLessorCellPhone)
pdfFormFields.SetField("Lesseeworkphone", vsLesseeWorkPhone)
pdfFormFields.SetField("Lesseefaxphone", vsLesseeFaxPhone)
pdfFormFields.SetField("Lesseehomephone", vsLesseeHomePhone)
pdfFormFields.SetField("LesseeCellphone", vsLesseeCellPhone)
pdfFormFields.SetField("LessorEMAIL", vsLessorEMAIL)
pdfFormFields.SetField("LesseeEMAIL", vsLesseeEMAIL)
pdfFormFields.SetField("LessorTIN", vsLessorTIN)
pdfFormFields.SetField("LesseeTIN", vsLesseeTIN)
pdfFormFields.SetField("LessorBrokerName", vsLessorBrokerName)
pdfFormFields.SetField("LessorBrokerAddressLine1", vsLessorBrokerAddressLine1)
pdfFormFields.SetField("LessorBrokerAddressLine2", vsLessorBrokerAddressLine2)
pdfFormFields.SetField("LessorBrokerWorkPhone", vsLessorBrokerWorkPhone)
pdfFormFields.SetField("LessorBrokerFaxPhone", vsLessorBrokerFaxPhone)
pdfFormFields.SetField("LessorBrokerHomePhone", vsLessorBrokerHomePhone)
pdfFormFields.SetField("LessorBrokerCellPhone", vsLessorBrokerCellPhone)
pdfFormFields.SetField("LessorBrokerEMAIL", vsLessorBrokerEmail)
pdfFormFields.SetField("LessorBrokerTIN", vsLessorBrokerTIN)
pdfFormFields.SetField("LesseeBrokerName", vsLesseeBrokerName)
pdfFormFields.SetField("LesseeBrokerAddressLine1", vsLesseeBrokerAddressLine1)
pdfFormFields.SetField("LesseeBrokerAddressLine2", vsLesseeBrokerAddressLine2)
pdfFormFields.SetField("LesseeBrokerWorkPhone", vsLesseeBrokerWorkPhone)
pdfFormFields.SetField("LesseeBrokerFaxPhone", vsLesseeBrokerFaxPhone)
pdfFormFields.SetField("LesseeBrokerHomePhone", vsLesseeBrokerHomePhone)
pdfFormFields.SetField("LesseeBrokerCellPhone", vsLesseeBrokerCellPhone)
pdfFormFields.SetField("LesseeBrokerEMAIL", vsLesseeBrokerEmail)
pdfFormFields.SetField("LesseeBrokerTIN", vsLesseeBrokerTIN)
pdfFormFields.SetField("Lessor_PaymentAddressName", vsLessorPaymentAddressName)
pdfFormFields.SetField("Lessor_PaymentAddressLine1", vsLessorPaymentAddressLine1)
pdfFormFields.SetField("Lessor_PaymentAddressLine2", vsLessorPaymentAddressLine2)
pdfFormFields.SetField("Lessor_PaymentAddressLine3", vsLessorPaymentAddressLine3)
pdfFormFields.SetField("Lessee2Phone", vsLessee2Phone)
pdfFormFields.SetField("PremisesAddressFULL", vsPremisesAddressFull)
pdfFormFields.SetField("UserInfoStamp", "LeaseGen Version: " & VERSNUM & " " & "GENERATED " & Today & " BY: " & MDIParent1.CURRENTUSER)
  
pdfStamper.FormFlattening = True
 
' close the pdf
 
pdfStamper.Close()
 
'open pdfviewer and show temp file
FrmPDFViewer.Show()
FrmPDFViewer.AcroPDF1.src = TempPDFFilename
Exit Function

My Product Information:
Acrobat Standard 7.0.1, Windows
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
What API are you using that provides the PdfReader and PdfStamper objects? iText?
way2krazy
Registered: Dec 15 2010
Posts: 3
Yes iText... I've been looking all over and found many examples for C# but not too much for VB script.. I feel like it should be a simple line that I can add in my proceedure there that populates the fields on my pdf...
way2krazy
Registered: Dec 15 2010
Posts: 3
Does Nobody know the answer to this one? I really need to figure this out, please HELP!!! :S