ByteScout PDF Extractor SDK – VB.NET – Reduce Memory Usage

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – VB.NET – Reduce Memory Usage

ByteScout PDF Extractor SDK – VB.NET – Reduce Memory Usage

Program.vb

Imports Bytescout.PDFExtractor
Imports System.IO

Class Program

	Friend Shared Sub Main(args As String())

        ' When processing huge PDF documents you may run into OutOfMemoryException.
        ' This example demonstrates a way to spare the memory by disabling page data caching.

        ' Create Bytescout.PDFExtractor.TextExtractor instance
        Using extractor As New TextExtractor("demo", "demo")

            Try
                ' Load sample PDF document
                extractor.LoadDocumentFromFile("sample2.pdf")

                ' Disable page data caching, so processed pages wiil be disposed automatically
                extractor.PageDataCaching = PageDataCaching.None

                ' Save extracted text to file
                extractor.SaveTextToFile("output.txt")

            Catch exception As PDFExtractorException
                Console.Write(exception.ToString())
            End Try

        End Using

        ' Open result file in default associated application (for demo purposes)
        System.Diagnostics.Process.Start("output.txt")

    End Sub

End Class


  Click here to get your Free Trial version of the SDK

prev
next