Link Search Menu Expand Document

Download and Process file - VB.NET

PDF To HTML SDK sample in VB.NET demonstrating ‘Download and Process file’

Imports System.IO
Imports Bytescout.PDF2HTML

Class Program
    Friend Shared Sub Main(args As String())

        ' Create Bytescout.PDF2HTML.HTMLExtractor instance
        Dim extractor As New HTMLExtractor()
        extractor.RegistrationName = "demo"
        extractor.RegistrationKey = "demo"

        ' Set plain HTML extraction mode
        extractor.ExtractionMode = HTMLExtractionMode.PlainHTML

        ' Input file Url
        Dim inputUrl As String = ""

        ' Get Input Stream
        Dim inpStream As Stream = GetStreamFromUrl(inputUrl)

        ' Load sample PDF document stream

        ' Convert 1-st page to HTML and save it to file
        extractor.SaveHtmlPageToFile(0, "output.html")

        ' Cleanup

        ' Open output file in default associated application

    End Sub

    ''' <summary>
    ''' Get stream from Url
    ''' </summary>
    Private Shared Function GetStreamFromUrl(ByVal url As String) As Stream

        Dim oData As Byte() = Nothing

        Using wc As New System.Net.WebClient()
            oData = wc.DownloadData(url)
        End Using

        Return New MemoryStream(oData)

    End Function

End Class

Download Source Code (.zip)

Return to the previous page Explore PDF To HTML SDK