Every ByteScout tool contains example VB.NET source codes that you can find here or in the folder with installed ByteScout product. ByteScout PDF Extractor SDK was made to help with OCR with best dataset 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.
VB.NET code snippet like this for ByteScout PDF Extractor SDK works best when you need to quickly implement OCR with best dataset in your VB.NET application. This VB.NET sample code should be copied and pasted into your application’s code editor. Then just compile and run it to see how it works. Code testing will allow the function to be tested and work properly with your data.
Visit our website provides for free trial version of ByteScout PDF Extractor SDK. Free trial includes lots of source code samples to help you with your VB.NET project.
Imports Bytescout.PDFExtractor ' This example demonstrates the use of Optical Character Recognition (OCR) to extract text ' from scanned PDF documents and raster images. ' 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()) ' Create Bytescout.PDFExtractor.TextExtractor instance Dim extractor As New TextExtractor() extractor.RegistrationName = "demo" extractor.RegistrationKey = "demo" ' Load sample PDF document extractor.LoadDocumentFromFile("sample_ocr.pdf") ' Enable Optical Character Recognition (OCR) ' in .Auto mode (SDK automatically checks if needs to use OCR or not) extractor.OCRMode = OCRMode.Auto ' Set the location of OCR language data files extractor.OCRLanguageDataFolder = "c:\Program Files\Bytescout PDF Extractor SDK\ocrdata_best" ' Set OCR language extractor.OCRLanguage = "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 ' Set PDF document rendering resolution extractor.OCRResolution = 300 ' You can also apply various preprocessing filters ' to improve the recognition on low-quality scans. ' Automatically deskew skewed scans 'extractor.OCRImagePreprocessingFilters.AddDeskew() ' Remove vertical or horizontal lines (sometimes helps to avoid OCR engine's page segmentation errors) 'extractor.OCRImagePreprocessingFilters.AddVerticalLinesRemover() 'extractor.OCRImagePreprocessingFilters.AddHorizontalLinesRemover() ' Repair broken letters 'extractor.OCRImagePreprocessingFilters.AddDilate() ' Remove noise 'extractor.OCRImagePreprocessingFilters.AddMedian() ' Apply Gamma Correction 'extractor.OCRImagePreprocessingFilters.AddGammaCorrection() ' Add Contrast ' extractor.OCRImagePreprocessingFilters.AddContrast(20) ' (!) You can use new OCRAnalyzer class to find an optimal set of image preprocessing ' filters for your specific document. ' See "OCR Analyser" example. ' Save extracted text to file extractor.SaveTextToFile("output.txt") ' Cleanup extractor.Dispose() ' Open output file in default associated application System.Diagnostics.Process.Start("output.txt") End Sub End Class