ByteScout PDF To HTML SDK - VB.NET - Reduce Memory Usage - ByteScout

ByteScout PDF To HTML SDK – VB.NET – Reduce Memory Usage

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

ByteScout PDF To HTML SDK – VB.NET – Reduce Memory Usage

Program.vb

Imports Bytescout.PDF2HTML

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.PDF2HTML.HTMLExtractor instance
        Using extractor As New HTMLExtractor("demo", "demo")

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

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

                ' Save result to file
                extractor.SaveHtmlToFile("output.html")

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

        End Using

        ' Open the output file in default associated application
        System.Diagnostics.Process.Start("output.txt")

    End Sub
End Class


  Click here to get your Free Trial version of the SDK

Tutorials:

prev
next