.NET PDF to Image Converter SDK

Convert PDF to Image in VB.NET
If you want to render and convert PDF to Jpeg or other raster images in .NET project using VB.NET programming language, this online VB.NET developer guide will help you. You will know how to add CnetSDK .NET PDF to Image Converter library component to your VB.NET project. And you will get VB.NET APIs and methods for PDF conversion to JPEG/TIFF/PNG/BMP/GIF images. Also, free VB.NET demo codes for PDF rendering and converting are provided.
ADD & INTEGRATE PDF CONVERTER IN VB.NET PROJECT
To use advanced PDF to image converter features in your VB.NET program, you should firstly add VS .NET project reference to CnetSDK .NET PDF to Image Converter library component. In the downloaded free trial package, you will find that a .NET PDF converter library component called CnetSDK.PDFtoImage.Converter.Trial.dll is placed based on your Windows System (x86 & x64) and .NET Frameworks version (2.0 & greater). Please directly add your VB.NET project reference to suitable PDF to image converter library dll.

Please Note: a watermark ("www.cnetsdk.com") will be shown on each converted image file randomly if you are using free trial package of CnetSDK .NET PDF to Image Converter SDK.
CONVERSION APIS & METHODS FOR VB.NET PROJECT
CnetSDK .NET PDF to Image Converter SDK provides advanced VB.NET PDF to image rendering and converting APIs and methods for your .NET application development. PDF document can be easily loaded to your VB.NET project and converted to JPEG, PNG, BMP, TIFF, and GIF images in VB.NET. You can also use mature methods to adjust and set the size of output image file. Please see details as below.
1. How to Load PDF Document to VB.NET Application

' Load a PDF to VB.NET project from a file stream or memory stream.
public Boolean LoadPdfFile(Stream Stream)


' Load a PDF to VB.NET project from a local file on disk.
public Boolean LoadPdfFile(String fileName)



2. How to Get the Number of PDF Document Pages

public FilePageCount As Integer


3. How to Convert PDF to Image in VB.NET Application

' Convert page or pages of PDF to image(s) in VB.NET project.
' With current DPI value, the size of converted image is original size of PDF page.
public Bitmap ConvertToImage(Integer pageIndex)

' Convert page or pages of PDF to image(s) with desired image size.
public Bitmap ConvertToImage(Integer pageIndex, Integer ImageWidth, Integer ImageHeight)



4. How to Get Width and Height of PDF Document Page(s)

' Image width and height will be changed with different DPI values.
public Integer GetPageSetHeight(Integer pageIndex)
public Integer GetPageSetWidth(Integer pageIndex)



5. How to Set or Return DPI Value

public SetDPI As Double
CONVERSION SAMPLE CODE FOR VB.NET PROJECT
There are six pieces of VB.NET programming codes for how to convert PDF to (JPEG) images. You will know how to load PDF from Stream and String to your VB.NET project. And then, transform and convert PDF document page or pages to image file(s) in VB.NET. Moreover, you can choose to save and output image file with the original size of PDF document page, or you can directly specify image width and height for PDF to image conversion.
1. VB.NET Code Example: Load PDF Doc from Local File & Get the Page Number


Module LoadPDFfromFile
Sub Main()
   Dim PDFDoc As PdfFile = New PdfFile()
   PDFDoc.LoadPdfFile(filename)
   Dim Count As Integer = PDFDoc.FilePageCount
   Console.WriteLine(Count)
End Sub
End Module
2. VB.NET Code Example: Load PDF Doc from Stream & Get the Page Number


Module LoadPDFfromStream
Sub Main()
   Dim PDFDoc As PdfFile = New PdfFile()
   PDFDoc.LoadPdfFile(Stream)
   Dim Count As Integer = PDFDoc.FilePageCount
   Console.WriteLine(Count)
End Sub
End Module

3. VB.NET Code Example: Convert PDF Doc to Image(s) with Original Page Size


Module ConverPDFtoImagewithOriginalSize   
Sub Main()
   Dim PDFConverter As PdfFile = New PdfFile()
   PDFConverter.LoadPdfFile(filename)
   PDFConverter.SetDPI = 72
   Dim Count As Integer = PDFConverter.FilePageCount
   Dim i As Integer
   For i = 0 To Count- 1 Step i + 1
      Dim bmp As Bitmap = PDFConverter.ConvertToImage(i)
   Next
End Sub
End Module

4. VB.NET Code Example: Convert PDF Doc to Image(s) with Defined Size


Module ConvertPDFtoImagewithDefinedSize
Sub Main()
   Dim PDFtoImage As PdfFile = New PdfFile()
   PDFtoImage.LoadPdfFile(filename)
   PDFtoImage.SetDPI = 72
   Dim Count As Integer = PDFtoImage.FilePageCount
   Dim i As Integer
   For i = 0 To Count- 1 Step i + 1
      Dim ImageWidth As Integer = 2 * PDFtoImage.GetPageSetWidth(i);
      Dim ImageHeight As Integer = PDFtoImage.GetPageSetHeight(i) / 2;
      Dim bmp As Bitmap = PDFtoImage.ConvertToImage(i, ImageWidth, ImageHeight);
bmp.Save(Replace(("F:/CnetSDK" + Str(i) + ".bmp"), " ", ""), ImageFormat.Bmp)
   Next
End Sub
End Module

5. VB.NET Code Example: Convert PDF to JPEG Image, with Original Page Size


Module ConvertPDFtoJPG
Sub Main()
   Dim PDFConverter As PdfFile = New PdfFile()
   PDFConverter.LoadPdfFile(filename)
   Dim Count As Integer = PDFConverter.FilePageCount
   PDFConverter.SetDPI = 72
   Dim i As Integer
   For i = 0 To Count- 1 Step i + 1
      Dim bmp As Bitmap = PDFConverter.ConvertToImage(i)
      bmp.Save(Replace(("F:/CnetSDK" + Str(i) + ".jpeg"), " ", ""), ImageFormat.Jpeg)
   Next
End Sub
End Module

6. VB.NET Code Example: Convert PDF to JPEG Image, with Defined Size


Module ConvertPDFtoJPGwithDefinedSize
Sub Main()
   Dim PDFDocument As PdfFile = New PdfFile()
   PDFDocument.LoadPdfFile(filename)
   Dim Count As Integer = PDFDocument.FilePageCount
   PDFDocument.SetDPI = 150
   Dim i As Integer
   For i = 0 To Count- 1 Step i + 1
      Dim bmp As Bitmap = PDFDocument.ConvertToImage(i,768,1024)
      bmp.Save(Replace(("F:/CnetSDK" + Str(i) + ".jpeg"), " ", ""), ImageFormat.Jpeg)
   Next
End Sub
End Module
If you need to use CnetSDK .NET PDF to Image Converter SDK for .NET web application, we provide online PDF to image conversion tutorial for ASP.NET project. If you are using our PDF converter library for images in C# programming language, you may refer to this online guide: C# sample code for converting PDF document to image files.
PDF TO IMAGES CONVERSION IN VB.NET

VB.NET PDF to JPEG Conversion

VB.NET PDF to GIF Conversion

VB.NET PDF to TIFF Conversion

VB.NET PDF to PNG Conversion

VB.NET PDF to BMP Conversion

 VB.NET PDF to Multi-page TIFF Conversion