ByteScout PDF Extractor SDK - VB.NET - OCR Analyser in PDF - ByteScout

ByteScout PDF Extractor SDK – VB.NET – OCR Analyser in PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – VB.NET – OCR Analyser in PDF

OCR analyser in PDF in VB.NET and ByteScout PDF Extractor SDK

Tutorial: how to do OCR analyser in PDF in VB.NET

The coding tutorials are designed to help you test the features without need to write your own code. ByteScout PDF Extractor SDK helps with OCR analyser in PDF in VB.NET. ByteScout PDF Extractor SDK is the SDK that helps developers to extract data from unstructured documents, pdf, images, scanned and electronic forms. Includes AI functions like automatic table detection, automatic table extraction and restructuring, text recognition and text restoration from pdf and scanned documents. Includes PDF to CSV, PDF to XML, PDF to JSON, PDF to searchable PDF functions as well as methods for low level data extraction.

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 implement OCR analyser in PDF. VB.NET sample code is all you need: copy and paste the code to your VB.NET application’s code editor, add a reference to ByteScout PDF Extractor SDK (if you haven’t added yet) and you are ready to go! This basic programming language sample code for VB.NET will do the whole work for you in implementing OCR analyser in PDF in your app.

Our website provides free trial version of ByteScout PDF Extractor SDK. It comes along with all these source code samples with the goal to help you with your VB.NET application implementation.

Try ByteScout PDF Extractor SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

Program.vb
      
Imports System.Drawing Imports Bytescout.PDFExtractor ' This example demonstrates the use of OCR Analyser - a tooling class for analysis of scanned documents ' in PDF or raster image formats to find best parameters for Optical Character Recognition (OCR) that ' provide highest recognition quality. ' To make OCR work you should add the following references to your project: ' 'Bytescout.PDFExtractor.dll', 'Bytescout.PDFExtractor.OCRExtension.dll'. Class Program Friend Shared Sub Main(args As String()) ' Input document Dim inputDocument As String = ".\sample_ocr.pdf" ' Document page index Dim pageIndex As Integer = 0 ' Area of the document page to perform the analysis (optional). ' RectangleF.Empty means the full page. Dim rectangle As RectangleF = RectangleF.Empty ' New RectangleF(100, 50, 350, 250) ' Location of OCR language data files Dim ocrLanguageDataFolder As String = "c:\Program Files\Bytescout PDF Extractor SDK\ocrdata_best\" ' OCR language Dim ocrLanguage As String = "eng" ' "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/tree/master/ocrdata_best ' Create OCRAnalyzer instance and activate it with your registration information Using ocrAnalyzer As New OCRAnalyzer("demo", "demo") ' Display analysis progress AddHandler ocrAnalyzer.ProgressChanged, Sub(sender, message, progress, ByRef cancel) Console.WriteLine(message) End Sub ' Load document to OCRAnalyzer ocrAnalyzer.LoadDocumentFromFile(inputDocument) ' Setup OCRAnalyzer ocrAnalyzer.OCRLanguage = ocrLanguage ocrAnalyzer.OCRLanguageDataFolder = ocrLanguageDataFolder ' Set page area for analysis (optional) ocrAnalyzer.SetExtractionArea(rectangle) ' Perform analysis and get results Dim analysisResults As OCRAnalysisResults = ocrAnalyzer.AnalyzeByOCRConfidence(pageIndex) ' Now extract page text using detected OCR parameters Dim outputDocument As String = ".\result.txt" ' Create TextExtractor instance Using textExtractor As TextExtractor = New TextExtractor("demo", "demo") ' Load document to TextExtractor textExtractor.LoadDocumentFromFile(inputDocument) ' Setup TextExtractor textExtractor.OCRMode = OCRMode.Auto textExtractor.OCRLanguageDataFolder = ocrLanguageDataFolder textExtractor.OCRLanguage = ocrLanguage ' Apply analysys results to TextExtractor instance ocrAnalyzer.ApplyResults(analysisResults, textExtractor) ' Set extraction area (optional) textExtractor.SetExtractionArea(rectangle) ' Save extracted text to file textExtractor.SaveTextToFile(outputDocument) ' Open output file in default associated application (for demonstration purposes) System.Diagnostics.Process.Start(outputDocument) End Using End Using End Sub End Class

Try ByteScout PDF Extractor SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

VIDEO

ON-PREMISE VERSION INFORMATION

Get 60 Day Free Trial or Visit ByteScout PDF Extractor SDK Home Page

Explore ByteScout PDF Extractor SDK Documentation

Get ByteScout PDF Extractor SDK Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Tutorials:

prev
next