How to Convert a PDF to an Image in VB.NET

Written by ray padgett | 13/05/2017
How to Convert a PDF to an Image in VB.NET
You need a special plugin to read and convert PDF files in VB.NET. (Jupiterimages/Photos.com/Getty Images)

VB.NET does not work with PDF files out of the box. However, because of demand, the Visual Basic company offers a PDF plugin. This allows you to not only read PDF files in VB.NET, but convert them to an image format (TIFF) you can use elsewhere. To do so, you first need to install the PDF plugin and then run some VB NET code.

Download the PDF plugin from the VB.NET website (link in Resources) by clicking the link marked "download the mjwPDF class and the PDF fonts." Click "Run" when the window pops up asking you what to do.

Open VB.NET and select "Add" from the "Project" menu.

Browse to the file you just downloaded. Click "mjwPDF.cls" and hit "Open." VB.NET is now PDF-compatible.

Copy and paste the following code into VB.NET (but do not hit the "Enter" key yet):

Dim no Append As TiffEncoder = New TiffEncoder(TiffCompression.Default, True)

Dim pdf As PdfDecoder = New PdfDecoder(FILEPDF)

Dim i As Integer=0

Do While i< numPages

Loop

Replace "FILEPDF" with the location of the PDF file you wish to convert. For instance, if it is a file named "MyDoc.pdf" on your desktop, type "C:\Desktop\MyDoc.pdf".

Replace "FILETIFF" with the desired name and location of the result image (TIFF) file.

Hit the "Enter" key.

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.