ByteScout Barcode Reader SDK - VB.NET - Decode Macro PDF 417 - ByteScout

ByteScout Barcode Reader SDK – VB.NET – Decode Macro PDF 417

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – VB.NET – Decode Macro PDF 417

How to decode macro PDF 417 in VB.NET and ByteScout BarCode Reader SDK

What is ByteScout BarCode Reader SDK? It is the barcode decoder with support for code 39, code 128, QR Code, Datamatrix, GS1, PDF417 and all other popular barcodes. Can read barcodes from images, pdf, tiff documents and live web camera. Supports noisy and damaged documents, can split and merge pdf and tiff documents based on barcodes. Can export barcode decoder results to XML, JSON, CSV and into custom data structures.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Module1.vb
      
Imports System.IO Imports System.Linq Imports System.Text Imports Bytescout.BarCodeReader Module Module1 Sub Main() ' Input Image files Dim ImageFiles = New String() {"MacroPDFBarcode-part1.png", "MacroPDFBarcode-part2.png", "MacroPDFBarcode-part3.png"} ' Create Instance of Macro PDF 417 class Dim oMacroPDF417Values = New MacroPDF417Values() ' Loop through input files to get value For Each itmInput As String In ImageFiles Using reader = New Reader("demo", "demo") ' ----------------------------------------------------------------------- ' NOTE: We can read barcodes from specific page to increase performance. ' For sample please refer To "Decoding barcodes from PDF by pages" program. ' ----------------------------------------------------------------------- ' Set barcode type to find reader.BarcodeTypesToFind.PDF417 = True ' Read barcodes Console.WriteLine("Reading barcode(s) from image {0}", Path.GetFullPath(itmInput)) Dim barcodes As FoundBarcode() = reader.ReadFrom(itmInput) For Each barcode As FoundBarcode In barcodes Console.WriteLine("Found Value: " & barcode.Value & vbLf) oMacroPDF417Values.AddValue(barcode.Value) Next End Using Next ' Get MacroPDF417 output value Dim outputValue = oMacroPDF417Values.GetValue() Console.WriteLine(vbLf & vbLf & "Consolidated Output Value: " & outputValue) Console.WriteLine(vbLf & vbLf & "Press any key to exit..") Console.ReadKey() End Sub Public Class MacroPDF417Values Public Sub New() lstSegments = New List(Of MacroPDFSegmment)() End Sub Public Property lstSegments As List(Of MacroPDFSegmment) ''' <summary> ''' Add Value ''' </summary> Public Sub AddValue(ByVal strValue As String) lstSegments.Add(New MacroPDFSegmment(strValue)) End Sub ''' <summary> ''' Get value ''' </summary> Public Function GetValue() As String Dim retValue = New StringBuilder("") For Each itmSegment As MacroPDFSegmment In lstSegments.Where(Function(x) x.SegmentNo > 0).OrderBy(Function(x) x.SegmentNo) retValue.Append(itmSegment.SegmentValue) Next Return retValue.ToString() End Function End Class Public Class MacroPDFSegmment Public Sub New() End Sub Public Sub New(ByVal inpValue As String) If Not String.IsNullOrEmpty(inpValue) Then Segments = inpValue.Split("\"c) End If End Sub Private Property Segments As String() ''' <summary> ''' Get Segment Index ''' </summary> Public ReadOnly Property SegmentNo As Integer Get Dim retSegmentValue As Integer = -1 Dim segmentVal = GetSegmentValue(2) If Not String.IsNullOrEmpty(segmentVal) Then Integer.TryParse(segmentVal, retSegmentValue) End If Return retSegmentValue End Get End Property ''' <summary> ''' Get Segment Value ''' </summary> Public ReadOnly Property SegmentValue As String Get Return GetSegmentValue(1) End Get End Property ''' <summary> ''' Get Segment Value ''' </summary> Public Function GetSegmentValue(ByVal segmentNo As Integer) As String If Segments IsNot Nothing AndAlso Segments.Length >= segmentNo Then Return Segments(segmentNo - 1) End If Return "" End Function End Class End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

ReadMacroPDF417.VS2005.vbproj
      
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{75D64BA4-2691-4BBA-A89D-B575EE05AB63}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>ReadMacroPDF417.Module1</StartupObject> <RootNamespace>ReadMacroPDF417</RootNamespace> <AssemblyName>ReadMacroPDF417</AssemblyName> <MyType>Console</MyType> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>ReadMacroPDF417.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <DefineDebug>false</DefineDebug> <DefineTrace>true</DefineTrace> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DocumentationFile>ReadMacroPDF417.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.BarCodeReader, Version=8.20.0.1340, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Bytescout BarCode Reader SDK\net2.00\Bytescout.BarCodeReader.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Deployment" /> <Reference Include="System.Drawing" /> <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="Module1.vb" /> </ItemGroup> <ItemGroup> <Content Include="MacroPDFBarcode-part1.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="MacroPDFBarcode-part2.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="MacroPDFBarcode-part3.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

ReadMacroPDF417.VS2008.vbproj
      
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{75D64BA4-2691-4BBA-A89D-B575EE05AB63}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>ReadMacroPDF417.Module1</StartupObject> <RootNamespace>ReadMacroPDF417</RootNamespace> <AssemblyName>ReadMacroPDF417</AssemblyName> <MyType>Console</MyType> <OldToolsVersion>2.0</OldToolsVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>ReadMacroPDF417.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <DefineDebug>false</DefineDebug> <DefineTrace>true</DefineTrace> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DocumentationFile>ReadMacroPDF417.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.BarCodeReader, Version=8.20.0.1340, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Bytescout BarCode Reader SDK\net3.50\Bytescout.BarCodeReader.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Deployment" /> <Reference Include="System.Drawing" /> <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="Module1.vb" /> </ItemGroup> <ItemGroup> <Content Include="MacroPDFBarcode-part1.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="MacroPDFBarcode-part2.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="MacroPDFBarcode-part3.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

ReadMacroPDF417.VS2010.vbproj
      
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion> </ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{75D64BA4-2691-4BBA-A89D-B575EE05AB63}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>ReadMacroPDF417.Module1</StartupObject> <RootNamespace>ReadMacroPDF417</RootNamespace> <AssemblyName>ReadMacroPDF417</AssemblyName> <MyType>Console</MyType> <OldToolsVersion>3.5</OldToolsVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>ReadMacroPDF417.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <DefineDebug>false</DefineDebug> <DefineTrace>true</DefineTrace> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DocumentationFile>ReadMacroPDF417.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.BarCodeReader, Version=8.20.0.1340, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Bytescout BarCode Reader SDK\net4.00\Bytescout.BarCodeReader.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Deployment" /> <Reference Include="System.Drawing" /> <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="Module1.vb" /> </ItemGroup> <ItemGroup> <Content Include="MacroPDFBarcode-part1.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="MacroPDFBarcode-part2.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="MacroPDFBarcode-part3.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next