ByteScout Text Recognition SDK - VB.NET - Save OCR Objects As JSON - ByteScout

ByteScout Text Recognition SDK – VB.NET – Save OCR Objects As JSON

  • Home
  • /
  • Articles
  • /
  • ByteScout Text Recognition SDK – VB.NET – Save OCR Objects As JSON

How to save OCR objects as JSON in VB.NET using ByteScout Text Recognition SDK

ByteScout Text Recognition SDK is the software development kit for automatic text recognition and OCR from pdf documents and images. Can recognize English and non-English languages.

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 Imports System.Diagnostics Imports Bytescout.TextRecognition Module Module1 Sub Main() Dim inputDocument As String = ".\ocr-sample.pdf" Dim outputDocument As String = ".\result.json" ' Create and activate TextRecognizer instance Using textRecognizer As TextRecognizer = New TextRecognizer("demo", "demo") Try ' Load document (image or PDF) textRecognizer.LoadDocument(inputDocument) ' Set the location of OCR language data files textRecognizer.OCRLanguageDataFolder = "c:\Program Files\ByteScout Text Recognition SDK\ocrdata_best\" ' Set OCR language. ' "eng" for english, "deu" for German, "fra" for French, "spa" for Spanish, etc. - according to files in "ocrdata" folder ' Find more language files at https://github.com/bytescout/ocrdata textRecognizer.OCRLanguage = "eng" ' Recognize text from page and save objects as word to json file textRecognizer.SaveOCRObjectsAsJSON(outputDocument, 0, OCRObjectType.Word) ' Open the result file in default associated application (for demo purposes) Process.Start(outputDocument) Catch exception As Exception Console.WriteLine(exception) End Try End Using End Sub End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Text Recognition SDK Home Page

Explore ByteScout Text Recognition SDK Documentation

Explore Samples

Sign Up for ByteScout Text Recognition SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

SaveOcrObjectAsJson.vbproj
      
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion> </ProductVersion> <SchemaVersion> </SchemaVersion> <ProjectGuid>{E5339352-1EBE-4547-B281-88D9FEEF92D7}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>SaveOcrObjectAsJson.Module1</StartupObject> <RootNamespace>SaveOcrObjectAsJson</RootNamespace> <AssemblyName>SaveOcrObjectAsJson</AssemblyName> <FileAlignment>512</FileAlignment> <MyType>Console</MyType> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkProfile>Client</TargetFrameworkProfile> </PropertyGroup> <PropertyGroup> <OptionExplicit>On</OptionExplicit> </PropertyGroup> <PropertyGroup> <OptionCompare>Binary</OptionCompare> </PropertyGroup> <PropertyGroup> <OptionStrict>Off</OptionStrict> </PropertyGroup> <PropertyGroup> <OptionInfer>On</OptionInfer> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> <DebugSymbols>true</DebugSymbols> <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>SaveOcrObjectAsJson.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> <DebugType>full</DebugType> <PlatformTarget>AnyCPU</PlatformTarget> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> <DefineTrace>true</DefineTrace> <OutputPath>bin\Release\</OutputPath> <DocumentationFile>SaveOcrObjectAsJson.xml</DocumentationFile> <Optimize>true</Optimize> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> <DebugType>pdbonly</DebugType> <PlatformTarget>AnyCPU</PlatformTarget> </PropertyGroup> <ItemGroup> <Reference Include="ByteScout.TextRecognition"> <HintPath>C:\Program Files\ByteScout Text Recognition SDK\net4.00\ByteScout.TextRecognition.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Drawing" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Module1.vb" /> </ItemGroup> <ItemGroup> <Content Include="..\..\ocr-sample.pdf"> <Link>ocr-sample.pdf</Link> <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 Text Recognition SDK Home Page

Explore ByteScout Text Recognition SDK Documentation

Explore Samples

Sign Up for ByteScout Text Recognition 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 Text Recognition SDK Home Page

Explore ByteScout Text Recognition SDK Documentation

Explore Samples

Sign Up for ByteScout Text Recognition SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next