ByteScout Invoice Parser SDK – VB.NET – Parse With OCR

  • Home
  • /
  • Articles
  • /
  • ByteScout Invoice Parser SDK – VB.NET – Parse With OCR

ByteScout Invoice Parser SDK – VB.NET – Parse With OCR


Imports ByteScout.InvoiceParser

' This example demonstrates the use of Optical Character Recognition (OCR) to parse invoice data 
' from scanned PDF documents and raster images.

Module Module1

    Sub Main()

        Dim inputDocument1 As String = ".\DigitalOcean-scanned.jpg"

        ' Create InvoiceParser instance
        Using invoiceParser As New InvoiceParser("demo", "demo")

            ' Enable Optical Character Recognition (OCR)
            ' in .Auto mode (SDK automatically checks if needs to use OCR or not)
            invoiceParser.OCRMode = OCRMode.Auto
            ' Set the location of "tessdata" folder containing language data files
            invoiceParser.OCRLanguageDataFolder = ".\tessdata\"

            ' Set OCR language
            invoiceParser.OCRLanguage = "eng"
            ' "eng" for english, "deu" for German, "fra" for French, "spa" for Spanish etc - according to files in /tessdata
            ' Find more language files at

            Console.WriteLine($"Parsing ""{inputDocument1}""...")

            ' Parse invoice data in JSON format
            Dim jsonString As String = invoiceParser.ParseDocument(inputDocument1, OutputFormat.JSON)
            ' Display parsed data in console
            Console.WriteLine("Parsing results in JSON format:")
        End Using

        Console.WriteLine("Press any key to continue...")

    End Sub

End Module

  Click here to get your Free Trial version of the SDK