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

Updated April 17, 2017

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


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.

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Based in New York City, Ray Padgett has been writing about music and technology since his 2009 graduation from Dartmouth College. He has a degree in religion, with a minor in English. He has been published in and in "The Celebrity Café," "The Noise" and an upcoming Bob Dylan anthology.