Link Search Menu Expand Document

Convert PDF To BMP (using Streams) - VB.NET

PDF Renderer SDK sample in VB.NET demonstrating ‘Convert PDF To BMP (using Streams)’


Imports Bytescout.PDFRenderer
Imports System.IO

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

        Dim srcStream = New FileStream("multipage.pdf", FileMode.Open)

        ' Create an instance of Bytescout.PDFRenderer.RasterRenderer object and register it.
        Using renderer = New RasterRenderer("demo", "demo")

            ' Load PDF document.

            For i As Integer = 0 To renderer.GetPageCount() - 1

                Dim fileName As String = "page" & i & ".png"

                If File.Exists(fileName) Then File.Delete(fileName)

                ' Render first page of the document to PNG image file.
                Using destStream As New FileStream(fileName, FileMode.CreateNew)
                    renderer.Save(destStream, RasterImageFormat.PNG, i, 300)
                End Using


        End Using

        ' Open the first output file in default image viewer.

    End Sub
End Class

Download Source Code (.zip)

Return to the previous page Explore PDF Renderer SDK