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.
- Skill level:
Other People Are Reading
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
Dim img As AtalaImage = pdfDecoder.Read(in Stream,i,Nothing) noAppend.Save(out Stream, img, Nothing) img.Dispose(FILETIFF) outStream.Seek(0, SeekOrigin.Begin) i += 1
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.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for