ByteScout Document Parser SDK - VB.NET - Create Custom Template - ByteScout

ByteScout Document Parser SDK – VB.NET – Create Custom Template

  • Home
  • /
  • Articles
  • /
  • ByteScout Document Parser SDK – VB.NET – Create Custom Template

How to create custom template in VB.NET using ByteScout Document Parser SDK

Write code in VB.NET to create custom template with this step-by-step tutorial

Create custom template is easy to implement in VB.NET if you use these source codes below. ByteScout Document Parser SDK is the robost offline data extraction platform for template based data extraction and processing. Supports high load with millions of documents as input. Templates can be quickly created and updated with no special technical knowledge required. It can be used to create custom template using VB.NET.

This code snippet below for ByteScout Document Parser SDK works best when you need to quickly create custom template in your VB.NET application. In your VB.NET project or application you may simply copy & paste the code and then run your app! Test VB.NET sample code examples whether they respond your needs and requirements for the project.

Trial version of ByteScout Document Parser SDK is available for free. Source code samples are included to help you with your VB.NET app.

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

Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27703.2026 MinimumVisualStudioVersion = 10.0.40219.1 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CustomTemplate", "CustomTemplate.vbproj", "{A5FA1293-C15B-4249-A771-ED4301658454}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {A5FA1293-C15B-4249-A771-ED4301658454}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A5FA1293-C15B-4249-A771-ED4301658454}.Debug|Any CPU.Build.0 = Debug|Any CPU {A5FA1293-C15B-4249-A771-ED4301658454}.Release|Any CPU.ActiveCfg = Release|Any CPU {A5FA1293-C15B-4249-A771-ED4301658454}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DCA85560-1523-40E0-917A-5BB3AA7E031F} EndGlobalSection EndGlobal

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>{A5FA1293-C15B-4249-A771-ED4301658454}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>CustomTemplate.Module1</StartupObject> <RootNamespace>CustomTemplate</RootNamespace> <AssemblyName>CustomTemplate</AssemblyName> <FileAlignment>512</FileAlignment> <MyType>Console</MyType> <TargetFrameworkVersion>v4.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> <DocumentationFile>CustomTemplate.xml</DocumentationFile> <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> <DocumentationFile>CustomTemplate.xml</DocumentationFile> <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.DocumentParser, Version=, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>c:\Program Files\ByteScout Document Parser SDK\net40\ByteScout.DocumentParser.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> </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" /> <Import Include="System.Linq" /> <Import Include="System.Xml.Linq" /> </ItemGroup> <ItemGroup> <Compile Include="Module1.vb" /> <Compile Include="My Project\AssemblyInfo.vb" /> <Compile Include="My Project\Application.Designer.vb"> <AutoGen>True</AutoGen> <DependentUpon>Application.myapp</DependentUpon> </Compile> <Compile Include="My Project\Resources.Designer.vb"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Resources.resx</DependentUpon> </Compile> <Compile Include="My Project\Settings.Designer.vb"> <AutoGen>True</AutoGen> <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Include="My Project\Resources.resx"> <Generator>VbMyResourcesResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.vb</LastGenOutput> <CustomToolNamespace>My.Resources</CustomToolNamespace> <SubType>Designer</SubType> </EmbeddedResource> </ItemGroup> <ItemGroup> <None Include="My Project\Application.myapp"> <Generator>MyApplicationCodeGenerator</Generator> <LastGenOutput>Application.Designer.vb</LastGenOutput> </None> <None Include="My Project\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <CustomToolNamespace>My</CustomToolNamespace> <LastGenOutput>Settings.Designer.vb</LastGenOutput> </None> <Content Include="SampleInvoice.pdf"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="SampleTemplate.yml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> </Project>

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

Imports ByteScout.DocumentParser ' This example demonstrates data parsing from an invoice using the custom template. Module Module1 Sub Main() Dim customTemplate As String = ".\SampleTemplate.yml" Dim inputDocument As String = ".\SampleInvoice.pdf" ' Create DocumentParser instance Using documentParser As New DocumentParser("demo", "demo") Console.WriteLine({code}quot;Loading template ""{customTemplate}""...") Console.WriteLine() documentParser.AddTemplate(customTemplate) Console.WriteLine({code}quot;Parsing ""{inputDocument}""...") Console.WriteLine() ' Parse invoice data in JSON format Dim jsonString As String = documentParser.ParseDocument(inputDocument, OutputFormat.JSON) ' Display parsed data in console Console.WriteLine("Parsing results in JSON format:") Console.WriteLine() Console.WriteLine(jsonString) End Using Console.WriteLine() Console.WriteLine("Press any key to continue...") Console.ReadLine() End Sub End Module

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

--- templateVersion: 1 sourceId: My Custom Template detectionRules: # Few regex expressions uniquely identifying the document design. # Don't forget to escape special characters. keywords: - Your Company Name - Invoice No\. - TOTAL # Expressions to extract distinct fields. # Last matching group or "<value>" group will be passed to result. fields: total: expression: TOTAL\s+(\d+\.\d+) type: decimal dateIssued: expression: Invoice Date (\d{2}/\d{2}/\d{4}) # If type is dateTime and dateFormat property is specified # the date will be converted to universal time by the specified format. type: dateTime dateFormat: MM/dd/yyyy invoiceId: expression: Invoice No. (\d+) # Static field that will be passed to result unchanged. sourceName: expression: Vendor Company static: true # Couple of fixed rectangular fields. # You can use "Template Editor" application to add them with ease. billTo: # Rectangle coordinates sequence: x, y, width, height. rect: - 32.25 - 150 - 348 - 70.5 notes: rect: - 32.25 - 227.25 - 531 - 47.25 # Optional page index parameter (zero-based) if you need to extract from specific page. pageIndex: 0 # Table data extraction. tables: - name: table1 start: # Table start after header row "Item Quantity Price Total". expression: Item\s+Quantity\s+Price\s+Total end: # Table rows last until "TOTAL" keyword. expression: TOTAL row: # Regex for table rows extraction. expression: ^\s*(?<description>\w+.*)(?<quantity>\d+)\s+(?<unitPrice>\d+\.\d{2})\s+(?<itemTotal>\d+\.\d{2})\s*$ types: # Column datatypes. Names correspond to regex matching groups. unitPrice: decimal itemTotal: decimal options: # multipage - set 'true' if table data can continue on following pages. multipage: false

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


Get 60 Day Free Trial or Visit ByteScout Document Parser SDK page

Explore ByteScout Document Parser SDK documentation


Sign Up for free Web API key

Explore Web API Documentation