Link Search Menu Expand Document

Extract PDF to Text as Stream - VB.NET

PDF Extractor SDK sample in VB.NET demonstrating ‘Extract PDF to Text as Stream’

Imports System.IO
Imports Bytescout.PDFExtractor

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

        ' Get page count
        Dim pageCount As Integer = extractor.GetPageCount()

        For i As Integer = 0 To pageCount - 1

            ' Create new stream. You can use MemoryStream or any other System.IO.Stream inheritor.
            Dim stream As FileStream = New FileStream(".\page" + i.ToString() + ".txt", FileMode.Create)

            ' Save text from page to the file stream
            extractor.SavePageTextToStream(i, stream)

            ' Close stream


        ' Cleanup

        ' Open result file in default associated application (for demo purposes)

    End Sub

End Class

Download Source Code (.zip)

Return to the previous page Explore PDF Extractor SDK