ByteScout PDF Extractor SDK - VB.NET - Read Values from Form Fields - ByteScout

ByteScout PDF Extractor SDK – VB.NET – Read Values from Form Fields

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – VB.NET – Read Values from Form Fields

How to read values from form fields in VB.NET using ByteScout PDF Extractor SDK

Write code in VB.NET to read values from form fields with this step-by-step tutorial

The code below will help you to implement an VB.NET app to read values from form fields. ByteScout PDF Extractor SDK is the Software Development Kit (SDK) that is designed to help developers with data extraction from unstructured documents like pdf, tiff, scans, images, scanned and electronic forms. The library is powered by OCR, computer vision and AI to provide unique functionality like table detection, automatic table structure extraction, data restoration, data restructuring and reconstruction. Supports PDF, TIFF, PNG, JPG images as input and can output CSV, XML, JSON formatted data. Includes full set of utilities like pdf splitter, pdf merger, searchable pdf maker. It can be used to read values from form fields using VB.NET.

This rich sample source code in VB.NET for ByteScout PDF Extractor SDK includes the number of functions and options you should do calling the API to read values from form fields. In order to implement the functionality, you should copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. This basic programming language sample code for VB.NET will do the whole work for you to read values from form fields.

Download free trial version of ByteScout PDF Extractor SDK from our website with this and other source code samples for VB.NET.

Try it today: Get 60 Day Free Trial or sign up for Web API

Imports System.Xml Imports Bytescout.PDFExtractor Module Program Sub Main() Try ' Create XMLExtractor interface Using extractor As New XMLExtractor("demo", "demo") ' Load Sample PDF document extractor.LoadDocumentFromFile("filled_form.pdf") ' Get PDF document text as XML Dim xmlText As String = extractor.GetXML ' Load XML Dim xmlDocument As XmlDocument = New XmlDocument xmlDocument.LoadXml(xmlText) ' Select all "control" nodes Dim formControls As XmlNodeList = xmlDocument.SelectNodes("//control") If (Not (formControls) Is Nothing) Then For Each formControl As XmlNode In formControls Dim typeAttribute As XmlAttribute = formControl.Attributes("type") ' Get filled textboxes If (typeAttribute.Value = "editbox") Then If Not String.IsNullOrEmpty(formControl.InnerText) Then Console.WriteLine(("EDITBOX " + (formControl.Attributes("id").Value + (": " + formControl.InnerText)))) End If End If ' Get checked checkboxes If (typeAttribute.Value = "checkbox") Then If (formControl.Attributes("state").Value = "1") Then Console.WriteLine(("CHECKBOX " _ + (formControl.Attributes("id").Value + (": " + formControl.Attributes("state").Value)))) End If End If Next End If End Using Catch ex As Exception Console.WriteLine(ex.Message) End Try Console.WriteLine() Console.WriteLine("Press any key to exit...") Console.ReadLine() End Sub End Module

Try it today: Get 60 Day Free Trial or sign up for Web API

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns=""> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{1A9B710D-F645-41B2-8F9F-50A78416F161}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>ReadValuesFromFormFields.Program</StartupObject> <RootNamespace>ReadValuesFromFormFields</RootNamespace> <AssemblyName>ReadValuesFromFormFields</AssemblyName> <FileAlignment>512</FileAlignment> <MyType>Console</MyType> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> <DebugType>pdbonly</DebugType> <DefineDebug>false</DefineDebug> <DefineTrace>true</DefineTrace> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <PropertyGroup> <OptionExplicit>On</OptionExplicit> </PropertyGroup> <PropertyGroup> <OptionCompare>Binary</OptionCompare> </PropertyGroup> <PropertyGroup> <OptionStrict>Off</OptionStrict> </PropertyGroup> <PropertyGroup> <OptionInfer>On</OptionInfer> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.PDFExtractor, Version=, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>c:\Program Files\Bytescout PDF Extractor SDK\net2.00\Bytescout.PDFExtractor.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Deployment" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Import Include="Microsoft.VisualBasic" /> <Import Include="System" /> <Import Include="System.Collections" /> <Import Include="System.Collections.Generic" /> <Import Include="System.Data" /> <Import Include="System.Diagnostics" /> </ItemGroup> <ItemGroup> <Compile Include="Program.vb" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> </Project>

Try it today: Get 60 Day Free Trial or sign up for Web API


Get 60 Day Free Trial or Visit ByteScout PDF Extractor SDK page

Explore ByteScout PDF Extractor SDK documentation


Sign Up for free Web API key

Explore Web API Documentation