This page helps you to learn from code samples for programming in VB.NET. ByteScout Premium Suite helps with fill form w 4 with pdf sdk in VB.NET. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
If you want to quickly learn then these fast application programming interfaces of ByteScout Premium Suite for VB.NET plus the guideline and the VB.NET code below will help you quickly learn fill form w 4 with pdf sdk. If you want to implement this functionality, you should copy and paste code below into your app using code editor. Then compile and run your application. VB.NET application implementation mostly involves various stages of the software development so even if the functionality works please check it with your data and the production environment.
ByteScout Premium Suite is available as a free trial. You may get it from our website along with all other source code samples for VB.NET applications.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
Imports Bytescout.PDF
''' <summary>
''' This example demonstrates how to fill PDF form programmatically.
''' </summary>
Class Program
Shared Sub Main()
' Map of form fields and sample values to set
Dim fieldMap As New Dictionary(Of String, Object)()
fieldMap.Add("f1_01[0]", "John J") ' FirstName And middle initial
fieldMap.Add("f1_02[0]", "Smith") ' LastName
fieldMap.Add("f1_03[0]", "111-111-3333") ' Security number
fieldMap.Add("f1_04[0]", "12 Palm st., Hill Valley") ' Home address
fieldMap.Add("f1_05[0]", "CA 12345") ' City, Town, State And ZIP
fieldMap.Add("c1_1[1]", "True") ' Married
fieldMap.Add("f1_06[0]", "123") ' Total number of allowance
fieldMap.Add("f1_07[0]", "443.44") ' Additional amount
fieldMap.Add("f1_09[0]", "Google, Somewhere in CA") ' Employer's name and address
fieldMap.Add("f1_10[0]", "12-3-2012") ' First date of employment
fieldMap.Add("f1_11[0]", "EMP223344") ' Employer identification number
' Load PDF form
Dim pdfDocument = New Document("W-4.pdf")
pdfDocument.RegistrationName = "demo"
pdfDocument.RegistrationKey = "demo"
' Get first page
Dim page = pdfDocument.Pages(0)
' Get widget by its name and change value
For Each keyValuePair In fieldMap
Dim annotation As Annotation = page.Annotations(keyValuePair.Key)
If TypeOf (annotation) Is CheckBox Then
CType(annotation, CheckBox).Checked = CType(keyValuePair.Value, Boolean)
ElseIf TypeOf (annotation) Is EditBox Then
CType(annotation, EditBox).Text = CType(keyValuePair.Value, String)
End If
Next
' Save modified document
pdfDocument.Save("result.pdf")
' Cleanup
pdfDocument.Dispose()
' Open document in default PDF viewer app
Process.Start("result.pdf")
End Sub
End Class
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: