Wanting convert PDF to BMP images in VB.NET, all you need are a few simple lines of code.
Imports System.Drawing Imports System.Drawing.Imaging Imports PQScan.PDFToImage Namespace PDF2BMP Class Program Private Shared Sub Main(args As String()) ' Create an instance of PQScan.PDFToImage.PDFDocument object. Dim pdfDoc As New PDFDocument() ' Load PDF document. pdfDoc.LoadPDF("sample.pdf") 'Get total page count. Dim count As Integer = pdfDoc.PageCount For i As Integer = 0 To count - 1 'Convert page to image Dim bitmap As Bitmap = pdfDoc.ToImage(i) 'Save image tobmp file type bitmap.Save("output" & i & ".bmp", ImageFormat.Bmp) Next End Sub End Class End Namespace
Look at the second VB.NET sample, loading PDF stream and turn it to Bmp image is just a piece of cake to you.
Imports System.IO Imports System.Drawing Imports System.Drawing.Imaging Imports PQScan.PDFToImage Namespace PDFToBMP Class Program Private Shared Sub Main(args As String()) ' Generate a new PDFDocument instance from PQScan.PDFToImage. Dim pdf As New PDFDocument() ' Open PDF document to file stream Dim stream As New FileStream("sample.pdf", FileMode.Open) ' Load message from PDF document stream. pdf.LoadPDF(stream) ' Specify bmp image width from PDF page Dim width As Integer = pdf.GetPageWidth(0) / 2 ' Specify bmp image height from PDF page Dim height As Integer = pdf.GetPageHeight(0) / 2 'Convert PDF first page to image with the customized size Dim bmp As Bitmap = pdf.ToImage(0, width, height) 'Save image to bmp format bmp.Save("result.bmp", ImageFormat.Bmp) End Sub End Class End Namespace
The output BMP images, you can keep them with original size or change them to wanted size. If you want to resize image and change image quality, you can see "How to customize output images from PDF using VB.NET".